Esempio n. 1
0
/*ARGSUSED*/
static void 
draw_it(XtPointer client_data, XtIntervalId *id)
{
    StripChartWidget w = (StripChartWidget)client_data;
    double value;
   
    if (w->strip_chart.update > 0)
	w->strip_chart.interval_id =
	    XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)w),
			    w->strip_chart.update * MS_PER_SEC,draw_it,
			    client_data);

    if (w->strip_chart.interval >= XtWidth(w))
	MoveChart((StripChartWidget)w, True);

    /* Get the value, stash the point and draw corresponding line */
    if (w->strip_chart.get_value == NULL)
	return;

    XtCallCallbacks((Widget)w, XtNgetValue, (XtPointer)&value);

    /* 
     * Keep w->strip_chart.max_value up to date, and if this data 
     * point is off the graph, change the scale to make it fit
     */
    if (value > w->strip_chart.max_value) {
	w->strip_chart.max_value = value;
	if (XtIsRealized((Widget)w) &&
	    w->strip_chart.max_value > w->strip_chart.scale) {
	    XClearWindow(XtDisplay(w), XtWindow(w));
	    w->strip_chart.interval = repaint_window(w, 0, XtWidth(w));
	}
    }

    w->strip_chart.valuedata[w->strip_chart.interval] = value;
    if (XtIsRealized((Widget)w)) {
	int y = (int)(XtHeight(w) - XtHeight(w) * value
		     / w->strip_chart.scale);

	XFillRectangle(XtDisplay(w), XtWindow(w), w->strip_chart.fgGC,
		       w->strip_chart.interval, y, 
		       1, XtHeight(w) - y);

	/*
	 * Fill in the graph lines we just painted over
	 */
	if (w->strip_chart.points != NULL) {
	    w->strip_chart.points[0].x = w->strip_chart.interval;
	    XDrawPoints(XtDisplay(w), XtWindow(w), w->strip_chart.hiGC,
			w->strip_chart.points, w->strip_chart.scale - 1,
			CoordModePrevious);
	}

	XFlush(XtDisplay(w));		    /* Flush output buffers */
    }
    w->strip_chart.interval++;		    /* Next point */
}
static void
XawViewportChangeManaged(Widget widget)
{
    ViewportWidget w = (ViewportWidget)widget;
    int num_children = w->composite.num_children;
    Widget child, *childP;
    int i;

    child = NULL;
    for (childP = w->composite.children,
	 i = 0; i < num_children;
	 childP++, i++) {
	if (XtIsManaged(*childP)
	    && *childP != w->viewport.clip
	    && *childP != w->viewport.horiz_bar
	    && *childP != w->viewport.vert_bar)	{
	    child = *childP;
	    break;
	}
    }

    if (child != w->viewport.child) {
	w->viewport.child = child;
	if (child != NULL) {
	    XtResizeWidget(child, XtWidth(child), XtHeight(child), 0);
	    if (XtIsRealized(widget)) {
		ViewportConstraints constraints =
		    (ViewportConstraints)child->core.constraints;
		if (!XtIsRealized(child)) {
		    Window window = XtWindow(w);

		    XtMoveWidget(child, 0, 0);
		    w->core.window = XtWindow(w->viewport.clip);
		    XtRealizeWidget(child);
		    w->core.window = window;
		    constraints->viewport.reparented = True;
		}
		else if (!constraints->viewport.reparented) {
		    XReparentWindow(XtDisplay(w), XtWindow(child),
				    XtWindow(w->viewport.clip), 0, 0);
		    constraints->viewport.reparented = True;
		    if (child->core.mapped_when_managed)
		    XtMapWidget(child);
		}
	    }
	    GetGeometry(widget, XtWidth(child), XtHeight(child));
	    (*((ViewportWidgetClass)w->core.widget_class)->form_class.layout)
	    ((FormWidget)w, XtWidth(w), XtHeight(w), True /* True? */);
	}
    }

#ifdef notdef
    (*Superclass->composite_class.change_managed)(widget);
#endif
}
Esempio n. 3
0
/* Blts data according to current size, then redraws the stripChart window
 * Next represents the number of valid points in data.  Returns the (possibly)
 * adjusted value of next.  If next is 0, this routine draws an empty window
 * (scale - 1 lines for graph).  If next is less than the current window width,
 * the returned value is identical to the initial value of next and data is
 * unchanged.  Otherwise keeps half a window's worth of data.  If data is
 * changed, then w->strip_chart.max_value is updated to reflect the
 * largest data point
 */
static int 
repaint_window(StripChartWidget w, int left, int width)
{
    int i, j;
    int next = w->strip_chart.interval;
    int scale = w->strip_chart.scale;
    int scalewidth = 0;

    /* Compute the minimum scale required to graph the data, but don't go
       lower than min_scale */
    if (w->strip_chart.interval != 0 || scale <= w->strip_chart.max_value)
	scale = w->strip_chart.max_value + 1;
	if (scale < w->strip_chart.min_scale)
	    scale = w->strip_chart.min_scale;

    if (scale != w->strip_chart.scale) {
	w->strip_chart.scale = scale;
	left = 0;
	width = next;
	scalewidth = XtWidth(w);

	XawStripChartResize((Widget)w);

	if (XtIsRealized((Widget)w))
	    XClearWindow(XtDisplay(w), XtWindow(w));
    }

    if (XtIsRealized((Widget)w)) {
	Display *dpy = XtDisplay(w);
	Window win = XtWindow(w);

	width += left - 1;
	if (!scalewidth)
	    scalewidth = width;

	if (next < ++width)
	    width = next;

	/* Draw data point lines */
	for (i = left; i < width; i++) {
	    int y = XtHeight(w) - (XtHeight(w) * w->strip_chart.valuedata[i])
				   / w->strip_chart.scale;

	    XFillRectangle(dpy, win, w->strip_chart.fgGC, 
			   i, y, 1, XtHeight(w) - y);
	}

	/* Draw graph reference lines */
	for (i = 1; i < w->strip_chart.scale; i++) {
	    j = i * ((int)XtHeight(w) / w->strip_chart.scale);
	    XDrawLine(dpy, win, w->strip_chart.hiGC, left, j, scalewidth, j);
	}
    }
    return (next);
}
Esempio n. 4
0
/*ARGSUSED*/
static void 
TreeUpdateHandler(
        Widget w,
        XtPointer client,
        XtPointer call )
{
    XmAnyCallbackStruct	    	*anyCB = (XmAnyCallbackStruct *)call;
    XmDisplay	  	dd = (XmDisplay) XmGetXmDisplay(XtDisplay(w));

    if (dd->display.dragReceiverProtocolStyle == XmDRAG_NONE)
		return;

    switch(anyCB->reason) {
      case XmCR_DROP_SITE_TREE_ADD:
	{
	    XmDropSiteTreeAddCallback cb =
	      (XmDropSiteTreeAddCallback)anyCB;

	    if (XtIsRealized(cb->rootShell)) {
		_XmSetDragReceiverInfo(dd, cb->rootShell);
	    }
	    else {
		XtAddEventHandler(cb->rootShell, 
				  StructureNotifyMask, False,
				  SetDragReceiverInfo,
				  (XtPointer)cb->rootShell);
	    }
	    /*
	     * ClientMessages are not maskable so all we have to
	     * do is indicate interest in non-maskable events.
	     */
	    XtAddEventHandler(cb->rootShell, NoEventMask, True,
			      ReceiverShellExternalSourceHandler,
			      (XtPointer)dd);
	}
	break;
      case XmCR_DROP_SITE_TREE_REMOVE:
	{
	    XmDropSiteTreeRemoveCallback cb =
	      (XmDropSiteTreeRemoveCallback)anyCB;
	    XtRemoveEventHandler(cb->rootShell, NoEventMask, True,
				 ReceiverShellExternalSourceHandler,
				 (XtPointer)dd);
	    if (XtIsRealized(cb->rootShell))
	      _XmClearDragReceiverInfo(cb->rootShell);
	}
	break;
      default:
	break;
    }
}
Esempio n. 5
0
XFE_CALLBACK_DEFN(XFE_TaskBar, updateFloatingBusyState)
	(XFE_NotificationCenter *	/* obj */,
	 void *						clientData,
	 void *						/* callData */)
{
	XP_Bool busy = (XP_Bool) (int) clientData;

	Widget floatingShell = XfeAncestorFindByClass(m_widget,
												  shellWidgetClass,
												  XfeFIND_ANY);

	// Dont update busy state if not realized/alive or undocked
	if (!XfeIsAlive(floatingShell) || 
		!XtIsRealized(floatingShell) ||
		XFE_Dashboard::isTaskBarDocked())
	{
		return;
	}

	if (busy)
	{
		MWContext *	context = m_parentFrame->getContext();
		Cursor		cursor = CONTEXT_DATA(context)->busy_cursor;

		XDefineCursor(XtDisplay(floatingShell),
					  XtWindow(floatingShell),
					  cursor);
	}
	else
	{
		XUndefineCursor(XtDisplay(floatingShell),XtWindow(floatingShell));
	}
}
Esempio n. 6
0
static void
InsertCursor(
		Widget w,
		Position x,
		Position y,
		XawTextInsertState state)
{
    MultiSinkObject sink = (MultiSinkObject) w;
    Widget text_widget = XtParent(w);
    XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
    XRectangle rect;

    sink->multi_sink.cursor_x = x;
    sink->multi_sink.cursor_y = y;

    rect.width = (unsigned short) insertCursor_width;
    rect.height = (unsigned short) ext->max_logical_extent.height;

    rect.x = (short) (x - (rect.width / 2));
    rect.y = (short) (y - rect.height);

    if (state != sink->multi_sink.laststate && XtIsRealized(text_widget)) {
	XDrawLine(XtDisplay(text_widget), XtWindow(text_widget),
		  sink->multi_sink.xorgc, rect.x + rect.width / 2,
		  rect.y, rect.x + rect.width / 2, rect.y + rect.height - 1);
    }
    sink->multi_sink.laststate = state;
}
Esempio n. 7
0
static void Show () {

    if (!Visible) {
	Dimension width, height;
	int i;

	XtManageChild (Main_form);
	HCI_Shell_popup( Main_widget );

	/* Map this window in the case that it is iconified */
	if (XtIsRealized (Main_widget))
	    XMapRaised (XtDisplay (Main_widget), XtWindow (Main_widget));

	if (Cancel_type == 1)
	    XtVaSetValues (Cancel_button, XmNsensitive, True, NULL);
	else
	    XtVaSetValues (Cancel_button, XmNsensitive, False, NULL);

	/* Do not allow resizes */
	XtVaGetValues (Main_widget, XmNwidth, &width, NULL);
	XtVaGetValues (Main_widget, XmNheight, &height, NULL);
	XtVaSetValues (Main_widget, XmNmaxWidth, width, 
			XmNminWidth, width,
			XmNmaxHeight, height, 
			XmNminHeight, height, NULL);
	Visible = 1;
	for (i = 0; i < 2; i++) {	/* to make sure the screen updates */
	    RefreshAppearance ();
	    msleep (10);
	}
    }
}
Esempio n. 8
0
/*
 * Append the varargs-string `fmt' to the currnent contents of the statusline
 * erasing it after `timeout' seconds if timeout > 0, unless the current statusline
 * contents matches pattern - in that case, overwrite the contents.
 */
void
statusline_append(statusTimerT timeout, const char *pattern, const char *fmt, ...)
{
    const char *buf = NULL;
    va_list argp;

    if (XtIsRealized(globals.widgets.top_level) && initialized && (resource.expert_mode & XPRT_SHOW_STATUSLINE) != 0) {
	/* get current statusline contents */
#ifdef MOTIF
	XtVaGetValues(statusline, XmNvalue, &buf, NULL);
#else
	XtVaGetValues(statusline, XtNlabel, &buf, NULL);
#endif
    }

    while (buf != NULL && isspace((int)*buf)) /* skip spaces inserted by statusline appending */
	buf++;
    va_start(argp, fmt);

    if (buf != NULL && memcmp(buf, pattern, strlen(pattern)) == 0) {
	buf = NULL;
    }
    internal_print_statusline(false, timeout, buf, fmt, argp);
    va_end(argp);
}
Esempio n. 9
0
static void
darkness_text_cb(Widget w, XtPointer client_data, XtPointer call_data)
{
    char *text;
    int val;
    struct topic_info *info = (struct topic_info *)client_data;
    struct prefs_choice *prefs = (struct prefs_choice *)(info->data);
    
#if USE_SPINBOX
    /* synchronize internal spinbox value. Apparently this loses the insertion position,
       so we need to save it and set it again. */
    XmTextPosition pos = XmTextFieldGetInsertionPosition(w);
    
    UNUSED(call_data);
    text = XmTextFieldGetString(w);
    val = strtol(text, (char **)NULL, 10);

    if (val != 0) {
	XtVaSetValues(w, XmNposition, val, NULL);
	XmTextFieldSetInsertionPosition(w, pos);
    }
#else
    Widget text_field;
    UNUSED(call_data);

    XtVaGetValues(w, XmNuserData, &text_field, NULL);
    XtVaGetValues(text_field, XmNvalue, &text, NULL);
    val = strtol(text, (char **)NULL, 10);
#endif
    if (XtIsRealized(w)) {
	do_set_density(val / 100.0, True, False);
	store_preference(&(prefs->db), "gamma", "%f", val / 100.0);
    }
    XtFree(text);
}
Esempio n. 10
0
File: DrawnB.c Progetto: att/uwin
static void
resize(Widget w)
{
    XmDrawnButtonCallbackStruct cbs;

    DEBUGOUT(_LtDebug(__FILE__, w, "Resize (%dx%d%+d%+d)\n",
		      XtWidth(w), XtHeight(w),XtX(w),XtY(w)));

#define superclass (&xmLabelClassRec)
    (*superclass->core_class.resize) (w);
#undef superclass

    if (XtIsRealized(w) && DB_ResizeCallback(w))
    {
	cbs.reason = XmCR_RESIZE;
	cbs.event = NULL;
	cbs.window = XtWindow(w);
	cbs.click_count = DB_ClickCount(w);

	XFlush(XtDisplay(w));

	XtCallCallbackList(w,
			   DB_ResizeCallback(w),
			   (XtPointer)&cbs);
    }
}
Esempio n. 11
0
File: DrawnB.c Progetto: att/uwin
static void
Activate(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XmDrawnButtonCallbackStruct cbs;

    DB_ClickCount(w) = 1;

    DB_Armed(w) = False;

    if (XtIsRealized(w))
	XtClass(w)->core_class.expose(w, event, NULL);

    if (event->xany.type == KeyPress || event->xany.type == KeyRelease ||
	(event->xbutton.x >= 0 && event->xbutton.x < XtWidth(w) &&
	 event->xbutton.y >= 0 && event->xbutton.y < XtHeight(w)))
    {
	cbs.reason = XmCR_ACTIVATE;
	cbs.event = event;
	cbs.window = XtWindow(w);
	cbs.click_count = DB_ClickCount(w);
	if (XmIsRowColumn(XtParent(w)))
	{
	    RC_MenuMenuCallback(w, &cbs);
	}
	if (!Lab_SkipCallback(w) && DB_ActivateCallback(w))
	{
	    XFlush(XtDisplay(w));

	    XtCallCallbackList(w,
			       DB_ActivateCallback(w),
			       (XtPointer)&cbs);
	}
    }
}
/* Paint the thumb in the area specified by w->top and
   w->shown.  The old area is erased.  The painting and
   erasing is done cleverly so that no flickering will occur. */
static void
PaintThumb(ScrollbarWidget w)
{
    Position oldtop, oldbot, newtop, newbot;

    oldtop = w->scrollbar.topLoc;
    oldbot = oldtop + w->scrollbar.shownLength;
    newtop = w->scrollbar.length * w->scrollbar.top;
    newbot = newtop + (int)(w->scrollbar.length * w->scrollbar.shown);
    if (newbot < newtop + (int)w->scrollbar.min_thumb)
	newbot = newtop + w->scrollbar.min_thumb;
    w->scrollbar.topLoc = newtop;
    w->scrollbar.shownLength = newbot - newtop;

    if (XtIsRealized((Widget)w)) {
	if (newtop < oldtop)
	    FillArea(w, newtop, XawMin(newbot, oldtop), 1);
	if (newtop > oldtop)
	    FillArea(w, oldtop, XawMin(newtop, oldbot), 0);
	if (newbot < oldbot)
	    FillArea(w, XawMax(newbot, oldtop), oldbot, 0);
	if (newbot > oldbot)
	    FillArea(w, XawMax(newtop, oldbot), newbot, 1);
    }
}
Esempio n. 13
0
File: Tree.c Progetto: aosm/X11libs
/* ARGSUSED */
static Boolean
XawTreeConstraintSetValues(Widget current, Widget request, Widget cnew,
			   ArgList args, Cardinal *num_args)
{
    TreeConstraints newc = TREE_CONSTRAINT(cnew);
    TreeConstraints curc = TREE_CONSTRAINT(current);
    TreeWidget tw = (TreeWidget) cnew->core.parent;

    /*
     * If the parent field has changed, remove the widget
     * from the old widget's children list and add it to the
     * new one.
     */
    if (curc->tree.parent != newc->tree.parent){
	if (curc->tree.parent)
	  delete_node (curc->tree.parent, cnew);
	if (newc->tree.parent)
	  insert_node(newc->tree.parent, cnew);

	/*
	 * If the Tree widget has been realized, 
	 * compute new layout.
	 */
	if (XtIsRealized((Widget)tw))
	  layout_tree (tw, FALSE);
    }
    return False;
}
Esempio n. 14
0
void XtUnrealizeWidget (
    Widget		widget)
{
    Window window;
    Widget hookobj;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    window = XtWindow(widget);
    if (! XtIsRealized (widget)) {
        UNLOCK_APP(app);
        return;
    }
    if (widget->core.managed && widget->core.parent != NULL)
        XtUnmanageChild(widget);
    UnrealizeWidget(widget);
    if (window != None)
        XDestroyWindow(XtDisplay(widget), window);
    hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
    if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
        XtChangeHookDataRec call_data;

        call_data.type = XtHunrealizeWidget;
        call_data.widget = widget;
        XtCallCallbackList(hookobj,
                           ((HookObject)hookobj)->hooks.changehook_callbacks,
                           (XtPointer)&call_data);
    }
    UNLOCK_APP(app);
} /* XtUnrealizeWidget */
Esempio n. 15
0
File: Command.c Progetto: aosm/X11
static Bool
ChangeSensitive(Widget w)
{
    CommandWidget cbw = (CommandWidget)w;

    if (XtIsRealized(w)) {
	if (XtIsSensitive(w)) {
	    if (w->core.border_pixmap != XtUnspecifiedPixmap)
		XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
				       w->core.border_pixmap);
	    else
		XSetWindowBorder(XtDisplay(w), XtWindow(w),
				 w->core.border_pixel);
	}
	else {
	    if (cbw->simple.insensitive_border == None)
		cbw->simple.insensitive_border =
		    XmuCreateStippledPixmap(XtScreen(w),
					    w->core.border_pixel,
					    cbw->command.set ?
						cbw->label.foreground :
						w->core.background_pixel,
					    w->core.depth);
	    XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
				   cbw->simple.insensitive_border);
	}
    }

    return (False);
}
Esempio n. 16
0
void
MapAgent::center_on (MapButton *map_button)
{
  // WXmPushButton button = map_button->f_button;
  WXmForm &button = map_button->f_form;
  WArgList args;
  Position bcenter_x, bcenter_y;
  Position pcenter_x, pcenter_y;
  Dimension pwidth, pheight;
  Dimension twidth, theight;
  Position off_x = 0, off_y = 0;

  bcenter_x = button.X() + button.Width() / 2;
  bcenter_y = button.Y() + button.Height() / 2;
  ON_DEBUG (printf ("Form widget id = %p\n", (Widget) button));
  ON_DEBUG (printf ("Button realized = %d\n", XtIsRealized (button)));
  ON_DEBUG (printf ("Button coords = (%d,%d)\n", button.X(), button.Y()));
  ON_DEBUG (printf("Button dims = (%d,%d)\n", button.Width(),button.Height()));
  ON_DEBUG (printf ("Button center = (%d,%d)\n", bcenter_x, bcenter_y));

  pwidth = f_porthole->Width();
  pheight = f_porthole->Height();
  twidth = f_tree->Width();
  theight = f_tree->Height();
  ON_DEBUG (printf ("Porthole dimensions = (%d,%d)\n", pwidth, pheight));
  ON_DEBUG (printf ("Tree dimensions = (%d,%d)\n", twidth, theight));

  pcenter_x = f_porthole->X() + pwidth / 2;
  pcenter_y = f_porthole->Y() + pheight / 2;
  ON_DEBUG (printf ("Porthole center = (%d,%d)\n", pcenter_x, pcenter_y));

  if (bcenter_x > pcenter_x)
    off_x = pcenter_x - bcenter_x;

  if (bcenter_y > pcenter_y)
    off_y = pcenter_y - bcenter_y;

  if (off_x + twidth < pwidth)
    off_x = pwidth - twidth;

  if (off_y + theight < pheight)
    off_y = pheight - theight;

  ON_DEBUG (printf ("Button center offset = (%d,%d)\n", off_x, off_y));

  if (off_x < 0)
    {
      f_tree->X (off_x, args);
      ON_DEBUG (printf ("Setting Tree X to %d\n", off_x));
    }

  if (off_y < 0)
    {
      f_tree->Y (off_y, args);
      ON_DEBUG (printf ("Setting Tree Y to %d\n", off_y));
    }

  if (args.NumArgs() > 0)
    f_tree->Set (args);
}
Esempio n. 17
0
/*----------------------------------------------------------------------*/
static void
Redisplay(Widget w,XEvent *event,Region region)
{
   /* Make sure the widget is realized before drawing ! */
   if (!XtIsRealized(w))
   {
      return;
   }

   switch(_XfeBufferType(w))
   {
       /* No buffer: simply re-draw everything */
   case XmBUFFER_NONE:
       _XfePrimitiveDrawEverything(w,event,region);
       break;
       
       /* Single buffer: draw the buffer only */
   case XmBUFFER_PRIVATE:
       _XfePrimitiveDrawBuffer(w,event,region);
       break;
       
       /* Multiple buffer: update the buffer and draw it */
   case XmBUFFER_SHARED:
       _XfePrimitiveDrawEverything(w,event,region);
       _XfePrimitiveDrawBuffer(w,event,region);
       break;
   }
}
Esempio n. 18
0
/*
 * NOTE: must be called after awt_root_shell is created and realized.
 */
Boolean
awt_dnd_init(Display* display) {
    static Boolean inited = False;

    if (!inited) {
        Boolean atoms_inited = False;
        Boolean ds_inited = False;
        unsigned int value = 1;
        MOTIF_BYTE_ORDER = (*((char*)&value) != 0) ? 'l' : 'B';

        /* NOTE: init_atoms() should be called before the rest of initialization
           so that atoms can be used. */
        inited = init_atoms(display);

        if (inited) {
            if (XtIsRealized(awt_root_shell)) {
                awt_root_window = XtWindow(awt_root_shell);
            } else {
                inited = False;
            }
        }

        inited = inited && awt_dnd_ds_init(display);
    }

    return inited;
}
Esempio n. 19
0
File: Simple.c Progetto: aosm/X11
static Bool
ChangeSensitive(Widget w)
{
    if (XtIsRealized(w)) {
	if (XtIsSensitive(w))
	    if (w->core.border_pixmap != XtUnspecifiedPixmap)
	    XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
				    w->core.border_pixmap);
	    else
		XSetWindowBorder(XtDisplay(w), XtWindow(w),
				 w->core.border_pixel);
	else {
	    if (((SimpleWidget)w)->simple.insensitive_border == None)
		((SimpleWidget)w)->simple.insensitive_border =
		    XmuCreateStippledPixmap(XtScreen(w),
					    w->core.border_pixel, 
					    w->core.background_pixel,
					    w->core.depth);
	    XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
				   ((SimpleWidget)w)->simple.insensitive_border);
	}
    }

    return (False);
}
/*ARGSUSED*/
static Boolean
XawScrollbarSetValues(Widget current, Widget request, Widget desired,
		      ArgList args, Cardinal *num_args)
{
    ScrollbarWidget w = (ScrollbarWidget)current;
    ScrollbarWidget dw = (ScrollbarWidget)desired;
    Boolean redraw = False;

    /*
     * If these values are outside the acceptable range ignore them...
     */
    if (dw->scrollbar.top < 0.0 || dw->scrollbar.top > 1.0)
	dw->scrollbar.top = w->scrollbar.top;

    if (dw->scrollbar.shown < 0.0 || dw->scrollbar.shown > 1.0)
	dw->scrollbar.shown = w->scrollbar.shown;

    if (XtIsRealized (desired)) {
	if (w->scrollbar.foreground != dw->scrollbar.foreground ||
	    w->core.background_pixel != dw->core.background_pixel ||
	    w->scrollbar.thumb != dw->scrollbar.thumb) {
	    XtReleaseGC((Widget)dw, w->scrollbar.gc);
	    CreateGC((Widget)dw);
	    redraw = True;
	}
	if (w->scrollbar.top != dw->scrollbar.top ||
	    w->scrollbar.shown != dw->scrollbar.shown)
	    redraw = True;
    }

    return (redraw);
}
Esempio n. 21
0
void
ui_refresh_widget_tree(
    Widget	widget
)
{
    WidgetList	children;
    int		num_children = 0;
    int		i;

    if (widget == NULL || !XtIsWidget(widget) || !XtIsRealized(widget))
	return;

    if (XtIsSubclass(widget, compositeWidgetClass))
    {
	XtVaGetValues(widget,
		XmNnumChildren,	&num_children,
		XmNchildren,	&children,
		NULL);

	/* Use recursion to traverse all the way to leaf nodes...*/
	for (i=0; i < num_children; i++)
	    ui_refresh_widget_tree(children[i]);
    }
    XClearArea(XtDisplay(widget), XtWindow(widget), 0, 0, 0, 0, TRUE);
}
Esempio n. 22
0
void
tb_set_pagehist_back_sensitivity(Boolean sensitive)
{
    if (!XtIsRealized(globals.widgets.top_level) || (resource.expert_mode & XPRT_SHOW_TOOLBAR) == 0)
	return;
    set_button_sensitivity(m_button_info.hyperref_back_button, sensitive);
}
Esempio n. 23
0
// Reset all values
void PlotArea::plot_reset(const char *)
{
    if (!XtIsRealized(area))
    {
	win = 0;
	return;
    }

    win = XtWindow(area);

    // Set scaling factor between internal driver & window geometry
    Dimension area_width, area_height;
    XtVaGetValues(area, 
		  XmNwidth, &area_width, 
		  XmNheight, &area_height, 
		  XtPointer(0));
    xscale = (double)area_width  / 4096.0;
    yscale = (double)area_height / 4096.0;

    // Reset center
    cx = 0;
    cy = 0;

    // Reset line type
    type = LineSolid;

    // Create new GC
    if (gc != 0)
	XFreeGC(dpy, gc);
    gc = XCreateGC(dpy, win, 0, (XGCValues *)0);
    XSetFont(dpy, gc, font->fid);
}
Esempio n. 24
0
static void
XawPortholeChangeManaged(Widget gw)
{
    PortholeWidget pw = (PortholeWidget)gw;
    Widget child = find_child (pw);	/* ignore extra children */

    if (child) {
	if (!XtIsRealized (gw)) {
	    XtWidgetGeometry geom, retgeom;

	    geom.request_mode = 0;
	    if (XtWidth(pw) == 0) {
		geom.width = XtWidth(child);
		geom.request_mode |= CWWidth;
	    }
	    if (XtHeight(pw) == 0) {
		geom.height = XtHeight(child);
		geom.request_mode |= CWHeight;
	    }
	    if (geom.request_mode &&
		XtMakeGeometryRequest (gw, &geom, &retgeom)
		== XtGeometryAlmost)
		(void)XtMakeGeometryRequest(gw, &retgeom, NULL);
	}
	
	XtResizeWidget(child, Max(XtWidth(child), XtWidth(pw)),
		       Max(XtHeight(child), XtHeight(pw)), 0);

	SendReport(pw, XawPRAll);
    }
}
Esempio n. 25
0
void KinoExpose (Widget w,  XEvent *e, Region region)
{
  LargeRegion rect;
  KinoWidget k;

  k = (KinoWidget) w;

  /* remap the screen coordinates to logical coordinates */

  rect.x = e->xexpose.x;
  rect.y = e->xexpose.y;
  rect.width = e->xexpose.width;
  rect.height = e->xexpose.height;

#ifdef DEBUG
  fprintf(stderr,"+++ %s: (%d|%d)-(%dx%d)\n", __PRETTY_FUNCTION__,
    rect.x, rect.y, rect.width, rect.height);
#endif

  /* tell the Painter to update the exposed region */
  
  PainterShow (k, rect, False);
  
#ifdef MOTIF
  if (XtIsRealized (w) && w->core.visible) 
  {
    /* tell gadgets to redisplay themselves */
    
    _XmRedisplayGadgets (w, e, region);
  }
#endif
}
Esempio n. 26
0
static void
CanvasResize(Widget w)
{
    if (!XtIsRealized(w))
        return;
    XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer) w);
}
Esempio n. 27
0
File: DrawnB.c Progetto: att/uwin
static void
Arm(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XmDrawnButtonCallbackStruct cbs;

    XmProcessTraversal(w, XmTRAVERSE_CURRENT);

    if (!DB_Armed(w))
    {
	DB_Armed(w) = True;
	if (event)
	    DB_ArmTimeStamp(w) = event->xbutton.time;

	if (XtIsRealized(w))
	    XtClass(w)->core_class.expose(w, event, NULL);

	if (DB_ArmCallback(w))
	{
	    cbs.reason = XmCR_ARM;
	    cbs.event = event;
	    cbs.window = XtWindow(w);
	    cbs.click_count = DB_ClickCount(w);

	    XFlush(XtDisplay(w));

	    XtCallCallbackList(w,
			       DB_ArmCallback(w),
			       (XtPointer)&cbs);
	}
    }
}
Esempio n. 28
0
void MotifUI::DumpWidget(Widget w, boolean verbose, int level)
{
   int i;

   for (i = 0; i < level; i++)
      printf("   ");
   printf("%s : %s", XrmQuarkToString(w->core.xrm_name),
	  w->core.widget_class->core_class.class_name);
   if (verbose)
    {
      int n = (level * 3) + strlen(XrmQuarkToString(w->core.xrm_name)) +
	      strlen(w->core.widget_class->core_class.class_name) + 3;
      for ( ; n < G_width; n++)
         printf(" ");
      if (XtIsManaged(w))
	 printf(" Managed  ");
      else
	 printf(" Unmanaged");
      if (XtIsSensitive(w))
	 printf(" Sensitive  ");
      else
	 printf(" Insensitive");
      if (XtIsRealized(w))
	 printf(" Realized  ");
      else
	 printf(" Unrealized");
      if (w->core.visible)
	 printf("  Visible\n");
      else
	 printf("  Invisible\n");
    }
   else
      printf("\n");
}
Esempio n. 29
0
File: DrawnB.c Progetto: att/uwin
static void
Disarm(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XmDrawnButtonCallbackStruct cbs;

    if (DB_Armed(w))
    {
	DB_Armed(w) = False;
	if (XtIsRealized(w))
	    XtClass(w)->core_class.expose(w, event, (Region)NULL);
    }

    if (DB_DisarmCallback(w))
    {
	cbs.reason = XmCR_DISARM;
	cbs.event = event;
	cbs.window = XtWindow(w);
	cbs.click_count = DB_ClickCount(w);

	XFlush(XtDisplay(w));

	XtCallCallbackList(w,
			   DB_DisarmCallback(w),
			   (XtPointer)&cbs);
    }
}
Esempio n. 30
0
static void   UngrabDevice(
    Widget	widget,
    Time	time,
    Boolean	isKeyboard)
{
    XtPerDisplayInput pdi;
    XtDevice device;

    LOCK_PROCESS;
    pdi = _XtGetPerDisplayInput(XtDisplay(widget));
    UNLOCK_PROCESS;
    device = isKeyboard ? &pdi->keyboard : &pdi->pointer;
    XtCheckSubclass(widget, coreWidgetClass,
		    "in XtUngrabKeyboard or XtUngrabPointer");

    if (device->grabType != XtNoServerGrab) {

	if (device->grabType != XtPseudoPassiveServerGrab
	    && XtIsRealized(widget)) {
	    if (isKeyboard)
		XUngrabKeyboard(XtDisplay(widget), time);
	    else
		XUngrabPointer(XtDisplay(widget), time);
	}
	device->grabType = XtNoServerGrab;
	pdi->activatingKey = (KeyCode)0;
    }
}