Doxygen Source Code Documentation
LiteClue.c File Reference
#include <unistd.h>#include <signal.h>#include <X11/IntrinsicP.h>#include <X11/StringDefs.h>#include "LiteClueP.h"#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | liteClue_context_str |
Defines | |
| #define | CheckWidgetClass(routine) |
| #define | offset(field) XtOffsetOf(LiteClueRec, field) |
| #define | BorderPix 3 |
| #define | ROUTINE "XcgLiteClueAddWidget" |
| #define | BADVALUE |
| #define | ROUTINE "XcgLiteClueDeleteWidget" |
| #define | BADVALUE |
| #define | ROUTINE "XcgLiteClueSetSensitive" |
| #define | BADVALUE |
| #define | ROUTINE "XcgLiteClueGetSensitive" |
| #define | BADVALUE False |
| #define | ROUTINE "XcgLiteClueDispatchEvent" |
| #define | BADVALUE False |
Functions | |
| void | RWC_xineramize (Display *, int, int, int, int, int *, int *) |
| Boolean | setValues (Widget _current, Widget _request, Widget _new, ArgList args, Cardinal *num_args) |
| void | Initialize (Widget treq, Widget tnew, ArgList args, Cardinal *num_args) |
| liteClue_context_str * | alloc_liteClue_context (void) |
| void | free_widget_context (XcgLiteClueWidget cw, struct liteClue_context_str *obj) |
| void | xcgListInit (ListThread *newbuf) |
| void | xcgListInsertBefore (ListThread *newlist, ListThread *poslist) |
| ListThread * | xcgListRemove (ListThread *rembuf) |
| void | compute_font_info (XcgLiteClueWidget cw) |
| void | create_GC (XcgLiteClueWidget cw) |
| void | wrong_widget (char *routine) |
| liteClue_context_str * | find_watched_widget (XcgLiteClueWidget cw, Widget target) |
| liteClue_context_str * | alloc_link_liteClue_context (XcgLiteClueWidget cw) |
| void | timeout_event (XtPointer client_data, XtIntervalId *id) |
| void | Enter_event (Widget w, XtPointer client_data, XEvent *xevent, Boolean *continue_to_dispatch) |
| void | Leave_event (Widget w, XtPointer client_data, XEvent *xevent, Boolean *continue_to_dispatch) |
| void | XcgLiteClueAddWidget (Widget w, Widget watch, char *text, int size, int option) |
| void | XcgLiteClueDeleteWidget (Widget w, Widget watch) |
| void | XcgLiteClueSetSensitive (Widget w, Widget watch, Boolean sensitive) |
| Boolean | XcgLiteClueGetSensitive (Widget w, Widget watch) |
| Boolean | XcgLiteClueDispatchEvent (Widget w, XEvent *event) |
Variables | |
| XtResource | resources [] |
| LiteClueClassRec | xcgLiteClueClassRec |
| WidgetClass | xcgLiteClueWidgetClass = (WidgetClass) & xcgLiteClueClassRec |
Define Documentation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Value: if (XtClass(w) != xcgLiteClueWidgetClass) \ return BADVALUE Definition at line 128 of file LiteClue.c. Referenced by XcgLiteClueAddWidget(), XcgLiteClueDeleteWidget(), XcgLiteClueDispatchEvent(), XcgLiteClueGetSensitive(), and XcgLiteClueSetSensitive(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function Documentation
|
|
Definition at line 399 of file LiteClue.c. References alloc_liteClue_context(), liteClue_context_str::cw, liteClue_context_str::next, and xcgListInsertBefore(). Referenced by XcgLiteClueAddWidget().
00400 {
00401 struct liteClue_context_str * out = alloc_liteClue_context();
00402
00403 /* link as new last */
00404 xcgListInsertBefore(&out->next, &cw->liteClue.widget_list);
00405 out->cw = cw; /* initialize this emeber - its always the same */
00406 return out;
00407 }
|
|
|
Definition at line 387 of file LiteClue.c. References liteClue_context_str::next, and xcgListInit(). Referenced by alloc_link_liteClue_context().
00388 {
00389 struct liteClue_context_str * out;
00390 out = (struct liteClue_context_str *) XtMalloc(sizeof(struct liteClue_context_str));
00391 memset(out, 0, sizeof(struct liteClue_context_str));
00392 xcgListInit(&out->next);
00393 return out ;
00394 }
|
|
|
Definition at line 311 of file LiteClue.c. References LiteCluePart::font, LiteCluePart::font_baseline, LiteCluePart::font_height, LiteCluePart::font_width, and _LiteClueRec::liteClue. Referenced by Initialize().
00312 {
00313 int direction_return;
00314 int font_ascent_return, font_descent_return;
00315 XCharStruct oret;
00316 if ( cw->liteClue.font == NULL )
00317 return;
00318 XTextExtents( cw->liteClue.font, "1", 1,
00319 &direction_return,
00320 &font_ascent_return, &font_descent_return, &oret);
00321
00322 cw->liteClue.font_baseline = oret.ascent; /* y offset from top to baseline,
00323 don't know why this is returned as negative */
00324 cw->liteClue.font_width = oret.width; /* the width and height of the object */
00325 cw->liteClue.font_height = oret.ascent+oret.descent;
00326 }
|
|
|
Definition at line 332 of file LiteClue.c. References _LiteClueRec::core, LiteCluePart::font, LiteCluePart::foreground, _LiteClueRec::liteClue, and LiteCluePart::text_GC. Referenced by Initialize(), and setValues().
00333 {
00334 XtGCMask valuemask;
00335 XGCValues myXGCV;
00336
00337
00338 valuemask = GCForeground | GCBackground | GCFillStyle ;
00339 myXGCV.foreground = cw->liteClue.foreground;
00340 myXGCV.background = cw->core.background_pixel;
00341 myXGCV.fill_style = FillSolid;
00342
00343 #if XtSpecificationRelease < 5 /* R4 hack */
00344 myXGCV.font = cw->liteClue.font->fid;
00345 #endif /* end R4 hack */
00346
00347 if (cw->liteClue.text_GC )
00348 XtReleaseGC((Widget) cw, cw->liteClue.text_GC );
00349 cw->liteClue.text_GC = XtGetGC((Widget)cw, valuemask, &myXGCV);
00350 }
|
|
||||||||||||||||||||
|
RWCox change to add a rectangle * Definition at line 549 of file LiteClue.c. References client_data, liteClue_context_str::cw, event, liteClue_context_str::sensitive, and timeout_event(). Referenced by XcgLiteClueAddWidget(), XcgLiteClueDeleteWidget(), and XcgLiteClueDispatchEvent().
00550 {
00551 struct liteClue_context_str * obj = (struct liteClue_context_str *) client_data;
00552 XcgLiteClueWidget cw = obj->cw;
00553 XEnterWindowEvent * event = & xevent->xcrossing;
00554 int current_waitPeriod ;
00555
00556 if (obj->sensitive == False)
00557 return;
00558 /* check for two enters in a row - happens when widget is
00559 exposed under a pop-up */
00560 if (cw->liteClue.interval_id != (XtIntervalId)0)
00561 return;
00562 if(event->mode != NotifyNormal)
00563 return;
00564
00565 /* if a help was recently popped down, don't delay in poping up
00566 help for next watched widget
00567 */
00568 if ((event->time - cw->liteClue.HelpPopDownTime) >
00569 cw->liteClue.cancelWaitPeriod )
00570 current_waitPeriod = cw->liteClue.waitPeriod,timeout_event;
00571 else
00572 current_waitPeriod = 0;
00573
00574 cw->liteClue.interval_id = XtAppAddTimeOut(
00575 XtWidgetToApplicationContext(w),
00576 current_waitPeriod, timeout_event, client_data);
00577 }
|
|
||||||||||||
|
Definition at line 369 of file LiteClue.c. References liteClue_context_str::watched_w. Referenced by XcgLiteClueAddWidget(), XcgLiteClueDeleteWidget(), XcgLiteClueGetSensitive(), and XcgLiteClueSetSensitive().
00371 {
00372 struct liteClue_context_str * obj;
00373
00374 for (obj = (struct liteClue_context_str *) cw->liteClue.widget_list.forw;
00375 obj != (struct liteClue_context_str *) & cw->liteClue.widget_list;
00376 obj = (struct liteClue_context_str *)obj->next.forw )
00377 {
00378 if (target == obj->watched_w)
00379 return obj;
00380 }
00381 return NULL;
00382 }
|
|
||||||||||||
|
Definition at line 412 of file LiteClue.c. References liteClue_context_str::sensitive, liteClue_context_str::text, xcgListRemove(), and XtFree. Referenced by XcgLiteClueDeleteWidget().
00413 {
00414 xcgListRemove((ListThread *)obj);
00415 /* free up all things object points to */
00416 obj->sensitive = False;
00417 if (obj->text )
00418 XtFree(obj->text);
00419 XtFree((char *) obj);
00420 }
|
|
||||||||||||||||||||
|
Definition at line 425 of file LiteClue.c. References args, compute_font_info(), create_GC(), LiteCluePart::HelpIsUp, LiteCluePart::HelpPopDownTime, LiteCluePart::interval_id, _LiteClueRec::liteClue, LiteCluePart::text_GC, LiteCluePart::widget_list, and xcgListInit().
00427 {
00428 XcgLiteClueWidget cw = (XcgLiteClueWidget) tnew;
00429
00430
00431 cw->liteClue.text_GC = NULL;
00432 cw->liteClue.HelpIsUp = False;
00433 cw->liteClue.HelpPopDownTime = 0;
00434 cw->liteClue.interval_id = (XtIntervalId)0;
00435 xcgListInit(&cw->liteClue.widget_list); /* initialize empty list */
00436 compute_font_info(cw);
00437 create_GC(cw );
00438 }
|
|
||||||||||||||||||||
|
Definition at line 582 of file LiteClue.c. References client_data, liteClue_context_str::cw, event, and liteClue_context_str::sensitive. Referenced by XcgLiteClueAddWidget(), XcgLiteClueDeleteWidget(), and XcgLiteClueDispatchEvent().
00583 {
00584 struct liteClue_context_str * obj = (struct liteClue_context_str *) client_data;
00585 XcgLiteClueWidget cw = obj->cw;
00586 XEnterWindowEvent * event = & xevent->xcrossing;
00587
00588 if (cw->liteClue.interval_id != (XtIntervalId)0)
00589 {
00590 XtRemoveTimeOut(cw->liteClue.interval_id);
00591 cw->liteClue.interval_id= (XtIntervalId)0;
00592 }
00593
00594 if (obj->sensitive == False)
00595 return;
00596 if (cw->liteClue.HelpIsUp)
00597 {
00598 XtPopdown((Widget) cw);
00599 cw->liteClue.HelpIsUp = False;
00600 cw->liteClue.HelpPopDownTime = event->time;
00601 }
00602 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 1537 of file xutil.c.
01539 {
01540 static int first=1 ;
01541 static int nxsi=0 , *xbot,*ybot,*xtop,*ytop ;
01542 int ii , ss ;
01543
01544 ENTRY("RWC_xineramize") ;
01545
01546 if( dpy==NULL || xn==NULL || yn==NULL || ww<0 || hh<0 ) EXRETURN; /* ERROR */
01547
01548 /*--- first time in: check AFNI.xinerama X resource
01549 load boundaries of sub-screens from resource ---*/
01550
01551 if( first ){
01552 char * xdef , * xp ;
01553 int nn,xorg,yorg,wide,high ;
01554
01555 first = 0 ; /* never again */
01556 xdef = getenv( "AFNI_XINERAMA" ) ;
01557
01558 if( xdef != NULL && (xdef[0] == 'N' || xdef[0] == 'n') ){ /* skip Xinerama */
01559 nxsi = 0 ;
01560 STATUS("AFNI_XINERAMA is NO") ;
01561 } else {
01562 xdef = XGetDefault(dpy,"AFNI","xinerama") ; /* get resource */
01563 if( xdef == NULL ) xdef = getenv("AFNI_xinerama") ; /* 27 Oct 2003 */
01564 if( xdef != NULL ){
01565 char *qdef = strdup(xdef) ;
01566 for( nn=0 ; qdef[nn] != '\0' ; nn++ )
01567 if( qdef[nn] == '_' || qdef[nn] == ':' ) qdef[nn] = ' ' ;
01568
01569 nn = 0 ; sscanf(qdef,"%d%n",&nxsi,&nn) ; /* number of sub-screens */
01570 if( nn <= 0 || nxsi <= 1 ){ /* ERROR */
01571 nxsi = 0 ;
01572 } else {
01573 xbot = (int *) malloc(sizeof(int)*nxsi) ; /* make arrays to */
01574 ybot = (int *) malloc(sizeof(int)*nxsi) ; /* store sub-screen */
01575 xtop = (int *) malloc(sizeof(int)*nxsi) ; /* coordinate ranges */
01576 ytop = (int *) malloc(sizeof(int)*nxsi) ;
01577 xp = qdef + nn ;
01578 for( ii=0 ; ii < nxsi ; ii++ ){ /* scan for sub-screen info */
01579 nn = 0 ;
01580 sscanf(xp,"%d%d%d%d%d%n",&ss,&xorg,&yorg,&wide,&high,&nn) ;
01581 if( nn <= 0 ) break ; /* ERROR */
01582 xbot[ii] = xorg ; xtop[ii] = xorg+wide ;
01583 ybot[ii] = yorg ; ytop[ii] = yorg+high ;
01584 xp += nn ;
01585
01586 if(PRINT_TRACING){
01587 char str[256] ;
01588 sprintf(str," Screen %d: xbot=%4d ybot=%4d xtop=%4d ytop=%4d",
01589 ii,xbot[ii],ybot[ii],xtop[ii],ytop[ii] ) ;
01590 STATUS(str) ;
01591 }
01592 }
01593
01594 nxsi = ii ; /* in case the scan aborted */
01595 }
01596 }
01597 }
01598
01599 /* if nothing found yet, use the display size */
01600
01601 if( nxsi <= 0 ){
01602 nxsi = 1 ;
01603 xbot = (int *) malloc(sizeof(int)*nxsi) ;
01604 ybot = (int *) malloc(sizeof(int)*nxsi) ;
01605 xtop = (int *) malloc(sizeof(int)*nxsi) ;
01606 ytop = (int *) malloc(sizeof(int)*nxsi) ;
01607 xbot[0] = ybot[0] = 0 ;
01608 xtop[0] = WidthOfScreen(DefaultScreenOfDisplay(dpy)) ;
01609 ytop[0] = HeightOfScreen(DefaultScreenOfDisplay(dpy)) ;
01610 }
01611 }
01612
01613 #if 0 /* doesn't occur anymore */
01614 if( nxsi == 0 ){ *xn=xx; *yn=yy; EXRETURN; } /* not setup? change nothing */
01615 #endif
01616
01617 /*--- find the Xinerama sub-screen that (xx,yy) is on (if any) ---*/
01618
01619 if( nxsi > 1 ){
01620 for( ss=0 ; ss < nxsi ; ss++ ){
01621 if( xx >= xbot[ss] && xx < xtop[ss] &&
01622 yy >= ybot[ss] && yy < ytop[ss] ) break ;
01623 }
01624 } else {
01625 ss = 0 ; /* must use #0 - what else is there? */
01626 }
01627
01628 if(PRINT_TRACING){
01629 char str[256] ;
01630 sprintf(str,"Rect: xx=%d yy=%d ww=%d hh=%d; On ss=%d",xx,yy,ww,hh,ss); STATUS(str);
01631 }
01632
01633 /*--- if not inside any screen, find one it is closest to ---*/
01634
01635 if( ss >= nxsi ){
01636 int dleft,dright,dtop,dbot,dd , dmin , xdif,ydif ;
01637 dmin = 123456789 ; ss = 0 ;
01638 for( ii=0 ; ii < nxsi; ii++ ){
01639 xdif = (xx < xbot[ii]) ? (xbot[ii]-xx) /* x dist to */
01640 :(xx > xtop[ii]) ? (xx-xtop[ii]) : 0 ; /* [xbot..xtop] */
01641
01642 ydif = (yy < ybot[ii]) ? (ybot[ii]-yy)
01643 :(yy > ytop[ii]) ? (yy-ytop[ii]) : 0 ;
01644
01645 dleft = abs(xx-xbot[ii]) + ydif ; /* L1 dist to left edge */
01646 dright = abs(xx-xtop[ii]) + ydif ;
01647 dbot = abs(yy-ybot[ii]) + xdif ;
01648 dtop = abs(yy-ytop[ii]) + xdif ;
01649
01650 dd = dleft ; /* find smallest dist */
01651 if( dright < dd ) dd = dright ;
01652 if( dbot < dd ) dd = dbot ;
01653 if( dtop < dd ) dd = dtop ;
01654
01655 if( dd < dmin ){ dmin = dd; ss = ii; } /* smallest so far? */
01656 }
01657
01658 if(PRINT_TRACING){
01659 char str[256] ; sprintf(str,"New ss=%d",ss) ; STATUS(str) ;
01660 }
01661 }
01662
01663 /*--- now adjust position so all of rectangle
01664 (xx..xx+ww,yy..yy+hh) fits on that screen (if possible) ---*/
01665
01666 if( xx+ww+BUF >= xtop[ss] ){ xx = xtop[ss]-ww-1-2*BUF; } /* move left */
01667 if( yy+hh+BUF >= ytop[ss] ){ yy = ytop[ss]-hh-1-2*BUF; } /* move up */
01668 if( xx < xbot[ss]+BUF ){ xx = xbot[ss]+BUF; } /* move right */
01669 if( yy < ybot[ss]+BUF ){ yy = ybot[ss]+BUF; } /* move down */
01670
01671
01672 if(PRINT_TRACING){
01673 char str[256] ; sprintf(str,"New xx=%d yy=%d",xx,yy) ; STATUS(str) ;
01674 }
01675
01676 *xn = xx ; *yn = yy ; EXRETURN ;
01677 }
|
|
||||||||||||||||||||||||
|
Definition at line 440 of file LiteClue.c. References args, _LiteClueRec::core, create_GC(), LiteCluePart::foreground, and _LiteClueRec::liteClue.
00441 {
00442 XcgLiteClueWidget cw_new = (XcgLiteClueWidget) _new;
00443 XcgLiteClueWidget cw_cur = (XcgLiteClueWidget) _current;
00444
00445 /* values of cw_new->liteClue.cancelWaitPeriod and
00446 cw_new->liteClue.waitPeriod are accepted without checking */
00447
00448 if (cw_new->liteClue.foreground != cw_cur->liteClue.foreground
00449 || cw_new->core.background_pixel != cw_cur->core.background_pixel )
00450 {
00451 create_GC(cw_new);
00452 }
00453
00454 return FALSE;
00455 }
|
|
||||||||||||
|
Definition at line 461 of file LiteClue.c. References client_data, liteClue_context_str::cw, RWC_xineramize(), liteClue_context_str::sensitive, liteClue_context_str::text, liteClue_context_str::text_size, and liteClue_context_str::watched_w. Referenced by Enter_event().
00462 {
00463 #define BorderPix 3
00464 struct liteClue_context_str * obj = (struct liteClue_context_str *) client_data;
00465 XcgLiteClueWidget cw = obj->cw;
00466 Position abs_x, abs_y;
00467
00468 XRectangle ink;
00469 XRectangle logical;
00470 Position w_height;
00471 Widget w;
00472
00473 int RWC_width , RWC_height ;
00474
00475 if (cw->liteClue.interval_id == (XtIntervalId)0)
00476 return; /* timeout was removed but callback happened anyway */
00477 cw->liteClue.interval_id = (XtIntervalId)0;
00478 if (obj->sensitive == False)
00479 return;
00480
00481 w = obj->watched_w;
00482 XtVaGetValues(w, XtNheight, &w_height, NULL );
00483 /* position just below the widget */
00484 XtTranslateCoords(w, 0, w_height, &abs_x, &abs_y);
00485
00486 #if XtSpecificationRelease < 5 /* R4 hack */
00487 {
00488 int direction_return;
00489 int font_ascent_return, font_descent_return;
00490 XCharStruct oret;
00491 XTextExtents( cw->liteClue.font ,obj->text , obj->text_size,
00492 &direction_return,
00493 &font_ascent_return, &font_descent_return, &oret);
00494 logical.width = oret.width;
00495 }
00496 #else
00497 XmbTextExtents(cw->liteClue.fontset, obj->text , obj->text_size ,&ink, &logical);
00498 #endif
00499
00500 RWC_width = 2*BorderPix +logical.width ;
00501 RWC_height = 2*BorderPix + cw->liteClue.font_height ;
00502 XtResizeWidget((Widget) cw, RWC_width , RWC_height ,
00503 cw->core.border_width );
00504
00505 /** RWCox change to widget location **/
00506 { int scw = WidthOfScreen(XtScreen(cw)) , sch = HeightOfScreen(XtScreen(cw)) ;
00507 int newx = abs_x + 1 , newy = abs_y+1 ; int xx,yy ;
00508 if( newx + logical.width > scw ) newx = scw - logical.width - 2*BorderPix ;
00509 if( newx < 0 ) newx = 0 ;
00510 if( newy + cw->liteClue.font_height + 2 >= sch )
00511 newy = newy - w_height - cw->liteClue.font_height - 2*BorderPix ;
00512 if( newy < 0 ) newy = 0 ;
00513
00514 #if 1
00515 RWC_xineramize( XtDisplay(w) , /* 27 Sep 2000 - see xutil.[ch] */
00516 newx,newy , RWC_width,RWC_height , &xx,&yy ) ;
00517 if( yy < newy )
00518 yy = newy - w_height - cw->liteClue.font_height - 2*BorderPix ;
00519 XtMoveWidget((Widget) cw, xx,yy);
00520 #else
00521 XtMoveWidget((Widget) cw, newx,newy);
00522 #endif
00523 }
00524
00525 XtPopup((Widget) cw, XtGrabNone);
00526 cw->liteClue.HelpIsUp = True;
00527
00528 #if XtSpecificationRelease < 5 /* R4 hack */
00529 XDrawImageString(XtDisplay((Widget) cw), XtWindow((Widget) cw),
00530 cw->liteClue.text_GC , BorderPix,
00531 BorderPix + cw->liteClue.font_baseline, obj->text , obj->text_size);
00532 #else
00533 XmbDrawImageString(XtDisplay((Widget) cw), XtWindow((Widget) cw),
00534 cw->liteClue.fontset,
00535 cw->liteClue.text_GC , BorderPix,
00536 BorderPix + cw->liteClue.font_baseline, obj->text , obj->text_size);
00537 #endif
00538
00539 /** RWCox change to add a rectangle **/
00540 XDrawRectangle( XtDisplay((Widget) cw) , XtWindow((Widget) cw) ,
00541 cw->liteClue.text_GC ,
00542 0,0 , RWC_width-1,RWC_height-1 ) ;
00543 }
|
|
|
Definition at line 357 of file LiteClue.c. References getpid(), and routine.
|
|
|
Definition at line 247 of file LiteClue.c. References list_thread_str::back, and list_thread_str::forw. Referenced by alloc_liteClue_context(), and Initialize().
|
|
||||||||||||
|
Definition at line 257 of file LiteClue.c. References list_thread_str::back, and list_thread_str::forw. Referenced by alloc_link_liteClue_context().
|
|
|
Definition at line 273 of file LiteClue.c. References list_thread_str::back, and list_thread_str::forw. Referenced by free_widget_context().
00274 {
00275 ListThread *prevbuf, *nextbuf;
00276
00277 prevbuf = rembuf->back;
00278 nextbuf = rembuf->forw;
00279
00280 prevbuf->forw = nextbuf;
00281 nextbuf->back = prevbuf;
00282
00283 rembuf->back = (ListThread *) NULL; /* for safety to cause trap if ..*/
00284 rembuf->forw = (ListThread *) NULL; /* .. mistakenly refed */
00285 return rembuf;
00286 }
|
|
||||||||||||||||||||||||
|
Definition at line 636 of file LiteClue.c. References alloc_link_liteClue_context(), CheckWidgetClass, Enter_event(), find_watched_widget(), Leave_event(), liteClue_context_str::sensitive, liteClue_context_str::text, liteClue_context_str::text_size, liteClue_context_str::watched_w, XtFree, and XtMalloc. Referenced by MCW_register_hint().
00637 {
00638 # define ROUTINE "XcgLiteClueAddWidget"
00639 # define BADVALUE /* nada */
00640 XcgLiteClueWidget cw = (XcgLiteClueWidget) w;
00641 struct liteClue_context_str * obj;
00642 Boolean exists = False;
00643
00644 CheckWidgetClass(ROUTINE); /* make sure we are called with a LiteClue widget */
00645
00646 obj = find_watched_widget(cw, watch);
00647 if (obj)
00648 {
00649 exists = True;
00650 if (text)
00651 {
00652 if(obj->text)
00653 XtFree(obj->text);
00654 obj->text = NULL;
00655 }
00656 }
00657 else
00658 {
00659 obj = alloc_link_liteClue_context(cw );
00660 obj->watched_w = watch;
00661 }
00662 if (text && !(obj->text))
00663 {
00664 if (!size)
00665 size = strlen(text);
00666 obj->text = (char*) XtMalloc(size+1);
00667 memcpy(obj->text, text, size);
00668 obj->text[size] = 0;
00669 obj->text_size = size;
00670 }
00671 if (!exists) /* was created */
00672 {
00673 XtAddEventHandler(watch, EnterWindowMask, False,
00674 Enter_event, (XtPointer) obj);
00675 XtAddEventHandler(watch, LeaveWindowMask|ButtonPressMask,
00676 False, Leave_event, (XtPointer) obj);
00677 obj->sensitive = True;
00678 }
00679
00680 # undef ROUTINE
00681 # undef BADVALUE
00682 }
|
|
||||||||||||
|
Definition at line 701 of file LiteClue.c. References CheckWidgetClass, Enter_event(), find_watched_widget(), free_widget_context(), LiteCluePart::interval_id, Leave_event(), and _LiteClueRec::liteClue. Referenced by MCW_unregister_hint().
00702 {
00703 # define ROUTINE "XcgLiteClueDeleteWidget"
00704 # define BADVALUE /* nada */
00705 XcgLiteClueWidget cw = (XcgLiteClueWidget) w;
00706 struct liteClue_context_str * obj;
00707
00708 CheckWidgetClass(ROUTINE); /* make sure we are called with a LiteClue widget */
00709 obj = find_watched_widget(cw, watch);
00710 if (obj)
00711 {
00712 XtRemoveEventHandler(watch, EnterWindowMask, False,
00713 Enter_event, (XtPointer) obj);
00714 XtRemoveEventHandler(watch, LeaveWindowMask|ButtonPressMask,
00715 False, Leave_event, (XtPointer) obj);
00716 if (cw->liteClue.interval_id != (XtIntervalId)0)
00717 {
00718 XtRemoveTimeOut(cw->liteClue.interval_id);
00719 cw->liteClue.interval_id= (XtIntervalId)0;
00720 }
00721 free_widget_context(cw, obj);
00722 }
00723
00724 # undef ROUTINE
00725 # undef BADVALUE
00726 }
|
|
||||||||||||
|
Definition at line 864 of file LiteClue.c. References CheckWidgetClass, Enter_event(), event, Leave_event(), and liteClue_context_str::watched_w.
00865 {
00866 # define ROUTINE "XcgLiteClueDispatchEvent"
00867 # define BADVALUE False
00868
00869 XcgLiteClueWidget cw = (XcgLiteClueWidget) w;
00870 struct liteClue_context_str * obj;
00871 Boolean continue_to_dispatch;
00872
00873 if (event->type != EnterNotify && event->type != LeaveNotify)
00874 return False;
00875 CheckWidgetClass(ROUTINE); /* make sure we are called with a LiteClue widget */
00876
00877 /* scan list */
00878 for (obj = (struct liteClue_context_str *) cw->liteClue.widget_list.forw;
00879 obj != (struct liteClue_context_str *) & cw->liteClue.widget_list;
00880 obj = (struct liteClue_context_str *)obj->next.forw )
00881 {
00882 if ((XtWindow(obj->watched_w) != event->xany.window)
00883 || (XtIsSensitive(obj->watched_w)) )
00884 continue;
00885 /* found one */
00886 if (event->type == EnterNotify )
00887 Enter_event(obj->watched_w, obj, event, &continue_to_dispatch);
00888 else
00889 Leave_event(obj->watched_w, obj, event, &continue_to_dispatch);
00890 return True;
00891 }
00892 return False;
00893
00894 # undef ROUTINE
00895 # undef BADVALUE
00896 }
|
|
||||||||||||
|
Definition at line 801 of file LiteClue.c. References CheckWidgetClass, find_watched_widget(), and liteClue_context_str::sensitive.
00802 {
00803 # define ROUTINE "XcgLiteClueGetSensitive"
00804 # define BADVALUE False
00805
00806 XcgLiteClueWidget cw = (XcgLiteClueWidget) w;
00807 struct liteClue_context_str * obj;
00808
00809 CheckWidgetClass(ROUTINE); /* make sure we are called with a LiteClue widget */
00810 if (watch)
00811 {
00812 obj = find_watched_widget(cw, watch);
00813 if (obj)
00814 return obj->sensitive;
00815 else
00816 return False;
00817 }
00818 /* do the first one */
00819 obj = (struct liteClue_context_str *) cw->liteClue.widget_list.forw;
00820 if (obj != (struct liteClue_context_str *) & cw->liteClue.widget_list)
00821 return obj->sensitive;
00822 else
00823 return False;
00824
00825 # undef ROUTINE
00826 # undef BADVALUE
00827 }
|
|
||||||||||||||||
|
Definition at line 749 of file LiteClue.c. References CheckWidgetClass, find_watched_widget(), and liteClue_context_str::sensitive.
00750 {
00751 # define ROUTINE "XcgLiteClueSetSensitive"
00752 # define BADVALUE /* nada */
00753 XcgLiteClueWidget cw = (XcgLiteClueWidget) w;
00754 struct liteClue_context_str * obj;
00755
00756 CheckWidgetClass(ROUTINE); /* make sure we are called with a LiteClue widget */
00757 if (watch)
00758 {
00759 obj = find_watched_widget(cw, watch);
00760 if (obj)
00761 {
00762 obj->sensitive = sensitive;
00763 return;
00764 }
00765 else
00766 return;
00767 }
00768
00769 /* do them all */
00770 for (obj = (struct liteClue_context_str *) cw->liteClue.widget_list.forw;
00771 obj != (struct liteClue_context_str *) & cw->liteClue.widget_list;
00772 obj = (struct liteClue_context_str *)obj->next.forw )
00773 {
00774 obj->sensitive = sensitive;
00775 }
00776
00777 # undef ROUTINE
00778 # undef BADVALUE
00779 }
|
Variable Documentation
|
|
Initial value:
{
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
offset(liteClue.foreground), XtRString, "black"},
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
offset(liteClue.font), XtRString,
"-adobe-new century schoolbook-bold-r-normal-*-14-*-*-*-*-*-*-*"},
{XgcNwaitPeriod, XgcCWaitPeriod, XtRInt , sizeof(int),
offset(liteClue.waitPeriod),XtRString, "500" },
{XgcNcancelWaitPeriod, XgcCCancelWaitPeriod, XtRInt , sizeof(int),
offset(liteClue.cancelWaitPeriod),XtRString, "2000" },
}Definition at line 157 of file LiteClue.c. |
|
|
Definition at line 184 of file LiteClue.c. |
|
|
Definition at line 240 of file LiteClue.c. |