예제 #1
0
void
_XmToolTipEnter (Widget wid,
                 XEvent * event,
                 String * params,
                 Cardinal * num_params)
{
    XmToolTipConfigTrait ttp;           /* ToolTip pointer */

    ttp = ToolTipGetData (wid);

    if (ttp == NULL)
    {
        XtWarning ("ToolTipGetData() returned NULL in _XmToolTipEnter()");
        return;
    }
    if ((XmIsPrimitive (wid) || XmIsGadget(wid)) && XmGetToolTipString(wid))
    {
        if (ttp->enable && !ttp->timer)
        {
            unsigned long delay;

            if (event &&
                    (event->xcrossing.time - ttp->leave_time < ttp->post_delay))
            {
                delay = 0;
            }
            else
            {
                delay = (unsigned long) ttp->post_delay;
            }
            if (ttp->duration_timer)
            {
                XtRemoveTimeOut (ttp->duration_timer);
                ttp->duration_timer = (XtIntervalId) NULL;
            }
            ttp->timer =
                XtAppAddTimeOut (XtWidgetToApplicationContext (wid), delay,
                                 (XtTimerCallbackProc) ToolTipPost, wid);
        }
    }
}
예제 #2
0
Boolean
XmWidgetGetBaselines(
    Widget wid,
    Dimension **baselines,
    int *line_count)
{
    _XmWidgetToAppContext(wid);
    _XmAppLock(app);

    if (XmIsPrimitive(wid))
    {
        XmPrimitiveClassExt              *wcePtr;
        WidgetClass   wc = XtClass(wid);

        wcePtr = _XmGetPrimitiveClassExtPtr(wc, NULLQUARK);

        if (*wcePtr && (*wcePtr)->widget_baseline)
        {
            _XmAppUnlock(app);
            return( (*((*wcePtr)->widget_baseline))
                    (wid, baselines, line_count)) ;
        }
    }
    else if (XmIsGadget(wid))
    {
        XmGadgetClassExt              *wcePtr;
        WidgetClass   wc = XtClass(wid);

        wcePtr = _XmGetGadgetClassExtPtr(wc, NULLQUARK);

        if (*wcePtr && (*wcePtr)->widget_baseline)
        {
            _XmAppUnlock(app);
            return( (*((*wcePtr)->widget_baseline))
                    (wid, baselines, line_count)) ;
        }
    }
    _XmAppUnlock(app);
    return (False);
}
예제 #3
0
Boolean
XmWidgetGetDisplayRect(
    Widget wid,
    XRectangle *displayrect)
{
    _XmWidgetToAppContext(wid);
    _XmAppLock(app);

    if (XmIsPrimitive(wid))
    {
        XmPrimitiveClassExt              *wcePtr;
        WidgetClass   wc = XtClass(wid);

        wcePtr = _XmGetPrimitiveClassExtPtr(wc, NULLQUARK);

        if (*wcePtr && (*wcePtr)->widget_display_rect)
            (*((*wcePtr)->widget_display_rect)) (wid, displayrect);
        _XmAppUnlock(app);
        return (True);
    }
    else if (XmIsGadget(wid))
    {
        XmGadgetClassExt              *wcePtr;
        WidgetClass   wc = XtClass(wid);

        wcePtr = _XmGetGadgetClassExtPtr(wc, NULLQUARK);

        if (*wcePtr && (*wcePtr)->widget_display_rect)
            (*((*wcePtr)->widget_display_rect)) (wid, displayrect);
        _XmAppUnlock(app);
        return (True);
    }
    else {
        _XmAppUnlock(app);
        return (False);
    }
}
예제 #4
0
WXPixmap wxBitmapCache::GetPixmapFromCache(WXWidget w)
{
    Widget widget = (Widget)w;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    while( XmIsGadget( widget ) )
        widget = XtParent( widget );

    WXPixel fg, bg;
    XtVaGetValues( widget,
                   XmNbackground, &bg,
                   XmNforeground, &fg,
                   NULL );

    Screen* screen = DefaultScreenOfDisplay( (Display*)m_display );
    return (WXPixmap)XmGetPixmap(screen, GetCacheImageName(m_image).data(), fg, bg);
}
예제 #5
0
파일: CWnd.C 프로젝트: dhaley/dcp
BOOL CWnd::xd_show_window(int nCmdShow)
{
    // Changes the visibility state of a child widget
    // by mapping or unmapping it or a child gadget by
    // managing or unmanaging it.

    Boolean wasvisible = TRUE;
    Boolean gadget     = XmIsGadget(_xd_rootwidget);

    if (gadget)
	wasvisible = XtIsManaged(_xd_rootwidget);
    else
	XtVaGetValues(_xd_rootwidget, XmNmappedWhenManaged, &wasvisible, NULL);

    switch(nCmdShow)
    {
	case SW_HIDE:       if (gadget)
				XtUnmanageChild(_xd_rootwidget);
			    else
				XtSetMappedWhenManaged(_xd_rootwidget, FALSE);
			    break;

	case SW_RESTORE:    if (gadget)
				XtManageChild(_xd_rootwidget);
			    else
				XtSetMappedWhenManaged(_xd_rootwidget, TRUE);
			    break;

        case SW_SHOW:            XtManageChild(_xd_rootwidget);
                            break;

	default:            cerr << "CWnd::ShowWindow: Only SW_HIDE and SW_RESTORE supported for child windows" << endl;
    }

    return wasvisible;
}
예제 #6
0
/************************************************************************
 *
 *  Redisplay
 *     General redisplay function called on exposure events.
 *
 ************************************************************************/
static void 
Redisplay(
        Widget wid,
        XEvent *event,
        Region region )
{
   XmFrameWidget fw = (XmFrameWidget) wid;
   Widget title_area = fw->frame.title_area;

   DrawShadow(fw);

   /* since the shadow may have screw up the gadget title, while this
      one won't get refresh, we have to redraw it manually */

   if (title_area && XmIsGadget(title_area) && XtIsManaged(title_area))
   {
      XClearArea (XtDisplay(fw), XtWindow(fw),
		  title_area->core.x, title_area->core.y,
		  title_area->core.width, title_area->core.height,
		  False);
      if (region && !XRectInRegion (region, title_area->core.x,
	title_area->core.y, title_area->core.width, title_area->core.height))
      {
	 XtExposeProc expose;

	 _XmProcessLock();
	 expose = title_area->core.widget_class->core_class.expose;
	 _XmProcessUnlock();

         if (expose)
	    (*expose)(title_area, event, NULL);
      }
   }

   XmeRedisplayGadgets( (Widget) fw, event, region);
}
예제 #7
0
static void
ToolTipPost (XtPointer client_data,
             XtIntervalId * id)
{
    Widget w = (Widget) client_data;

    int rx,
        ry,
        x,
        y;
    unsigned int key;
    Window root,
           child;
    XtWidgetGeometry geo;
    Position destX,
             destY;

    XmToolTipConfigTrait ttp; /* ToolTip pointer */

    ttp = ToolTipGetData (w);

    if (ttp == NULL)
    {
        XtWarning ("ToolTipGetData() returned NULL in ToolTipPost()");
        return;
    }

    ttp->timer = (XtIntervalId) NULL;

    XQueryPointer (XtDisplay (w),
                   XtWindow (w), &root, &child, &rx, &ry, &x, &y, &key);

    if (ttp->duration_timer != (XtIntervalId) NULL)
    {
        XtRemoveTimeOut (ttp->duration_timer);
        ttp->duration_timer = (XtIntervalId) NULL;
    }

    if (XmIsPrimitive(w) || XmIsGadget(w))
    {
        XtVaSetValues (ttp->label,
                       XmNlabelString,
                       XmGetToolTipString(w),
                       NULL);
    }
    else
    {
        XmString string;

        string = XmStringCreateLocalized (XtName (w));
        XtVaSetValues (ttp->label, XmNlabelString, string, NULL);
        XmStringFree (string);
    }
    XtQueryGeometry (ttp->label, NULL, &geo);

    /* rws 25 Feb 2001
       Fix for Bug #1153
       Don't let the tip be off the right/bottom of the screen
     */
    destX = rx + (XmIsGadget (w) ? XtX (w) : 0) - x + XtWidth (w) / 2;
    if (destX + geo.width > WidthOfScreen (XtScreen (w)))
    {
        destX = WidthOfScreen (XtScreen (w)) - geo.width;
    }
    destY = ry + (XmIsGadget (w) ? XtY (w) : 0) - y + XtHeight (w);
    if (destY + geo.height > HeightOfScreen (XtScreen (w)))
    {
        destY = ry + (XmIsGadget (w) ? XtY (w) : 0) - y - geo.height;
    }

    XtVaSetValues (XtParent (ttp->label),
                   XmNx, rx + 1,
                   XmNy, ry + 1, XmNwidth, 1, XmNheight, 1, NULL);
    ttp->slider =
        XtVaCreateWidget ("ToolTipSlider", xmSlideContextWidgetClass,
                          XmGetXmDisplay (XtDisplay (w)), XmNslideWidget,
                          XtParent (ttp->label),
                          XmNslideDestX, destX,
                          XmNslideDestY, destY,
                          XmNslideDestWidth, geo.width,
                          XmNslideDestHeight, geo.height, NULL);

    XtAddCallback (ttp->slider, XmNslideFinishCallback,
                   (XtCallbackProc) ToolTipPostFinish, ttp);

    XtPopup (XtParent (ttp->label), XtGrabNone);
}