Ejemplo n.º 1
0
static int grow_init_proc(Widget w, GlowCtx* fctx, void* client_data)
{
  growwidget_sScroll* scroll_data;
  GrowCtx* ctx;

  ctx = (GrowCtx*)((GrowWidget)w)->grow.grow_ctx;

  if (((GrowWidget)w)->grow.scroll_h) {
    scroll_data = (growwidget_sScroll*)malloc(sizeof(growwidget_sScroll));
    scroll_data->grow = w;
    scroll_data->scroll_h = ((GrowWidget)w)->grow.scroll_h;
    scroll_data->scroll_v = ((GrowWidget)w)->grow.scroll_v;
    scroll_data->form = ((GrowWidget)w)->grow.form;
    scroll_data->scroll_h_managed = 1;
    scroll_data->scroll_v_managed = 1;

    ctx->register_scroll_callback((void*)scroll_data, scroll_callback);

    XtAddCallback(
        scroll_data->scroll_h, XmNvalueChangedCallback, scroll_h_action, w);
    XtAddCallback(scroll_data->scroll_h, XmNdragCallback, scroll_h_action, w);
    XtAddCallback(
        scroll_data->scroll_h, XmNincrementCallback, scroll_h_action, w);
    XtAddCallback(
        scroll_data->scroll_h, XmNdecrementCallback, scroll_h_action, w);
    XtAddCallback(
        scroll_data->scroll_h, XmNpageIncrementCallback, scroll_h_action, w);
    XtAddCallback(
        scroll_data->scroll_h, XmNpageDecrementCallback, scroll_h_action, w);
    XtAddCallback(scroll_data->scroll_h, XmNtoTopCallback, scroll_h_action, w);
    XtAddCallback(
        scroll_data->scroll_h, XmNtoBottomCallback, scroll_h_action, w);

    XtAddCallback(
        scroll_data->scroll_v, XmNvalueChangedCallback, scroll_v_action, w);
    XtAddCallback(scroll_data->scroll_v, XmNdragCallback, scroll_v_action, w);
    XtAddCallback(
        scroll_data->scroll_v, XmNincrementCallback, scroll_v_action, w);
    XtAddCallback(
        scroll_data->scroll_v, XmNdecrementCallback, scroll_v_action, w);
    XtAddCallback(
        scroll_data->scroll_v, XmNpageIncrementCallback, scroll_v_action, w);
    XtAddCallback(
        scroll_data->scroll_v, XmNpageDecrementCallback, scroll_v_action, w);
    XtAddCallback(scroll_data->scroll_v, XmNtoTopCallback, scroll_v_action, w);
    XtAddCallback(
        scroll_data->scroll_v, XmNtoBottomCallback, scroll_v_action, w);
  }
  return (((GrowWidget)w)->grow.init_proc)(ctx, client_data);
}
Ejemplo n.º 2
0
static int grow_init_proc(QWidget* w, GlowCtx* fctx, void* client_data)
{
  QtScrollWidgetGlow* grow = ((QtScrollWidgetGlow*)w);
  GrowCtx* ctx = (GrowCtx*)grow->parent_ctx;

  if (grow->scroll_h) {
    widget_sScroll* scroll_data = new widget_sScroll();
    scroll_data->parent = w;
    scroll_data->scroll_h = grow->scroll_h;
    scroll_data->scroll_v = grow->scroll_v;
    scroll_data->scroll_h_managed = 1;
    scroll_data->scroll_v_managed = 1;

    ctx->register_scroll_callback((void*)scroll_data, scroll_callback);
  }
  return (grow->init_proc)(ctx, client_data);
}
Ejemplo n.º 3
0
static int grow_init_proc( GtkWidget *w, GlowCtx *fctx, void *client_data)
{
  growwidget_sScroll *scroll_data;
  GrowCtx	*ctx;

  ctx = (GrowCtx *) ((GrowWidgetGtk *) w)->grow_ctx;

  if ( ((GrowWidgetGtk *) w)->scroll_h) {
    scroll_data = (growwidget_sScroll *) malloc( sizeof( growwidget_sScroll));
    scroll_data->grow = w;
    scroll_data->scroll_h = ((GrowWidgetGtk *) w)->scroll_h;
    scroll_data->scroll_v = ((GrowWidgetGtk *) w)->scroll_v;
    scroll_data->form = ((GrowWidgetGtk *) w)->form;
    scroll_data->scroll_h_managed = 1;
    scroll_data->scroll_v_managed = 1;

    ctx->register_scroll_callback( (void *) scroll_data, scroll_callback);
  }
  return (((GrowWidgetGtk *) w)->init_proc)( ctx, client_data);
}
Ejemplo n.º 4
0
static void scroll_v_action( 	GtkWidget 	*w,
				gpointer 	data)
{
  GrowWidgetGtk *groww = (GrowWidgetGtk *)data;

  if ( groww->scroll_v_ignore) {
    groww->scroll_v_ignore = 0;
    return;
  }
    
  GrowCtx *ctx = (GrowCtx *) groww->grow_ctx;
  gdouble value;
  value = gtk_range_get_value( GTK_RANGE(groww->scroll_v));

  if ( value == 0 && fabs(groww->scroll_v_value) > 2) {
    // Probably a resize that seems to set value to zero, set old value
    ctx->change_scrollbar();
    return;
  }
  groww->scroll_v_value = value;

  glow_scroll_vertical( ctx, int(value), 0);
}