#include <X11/IntrinsicP.h>#include <X11/StringDefs.h>#include <X11/Xos.h>#include <X11/Xaw3d/XawInit.h>#include <X11/Xaw3d/LabelP.h>#include <X11/Xmu/Converters.h>#include <X11/Xmu/Drawing.h>#include <stdio.h>#include <ctype.h>#include <stdlib.h>Include dependency graph for Label.c:

Go to the source code of this file.
Defines | |
| #define | streq(a, b) (strcmp( (a), (b) ) == 0) |
| #define | MULTI_LINE_LABEL 32767 |
| #define | offset(field) XtOffsetOf(LabelRec, field) |
| #define | TXT16 XChar2b |
| #define | PIXMAP 0 |
| #define | WIDTH 1 |
| #define | HEIGHT 2 |
| #define | NUM_CHECKS 3 |
Functions | |
| static void | Initialize () |
| static void | Resize () |
| static void | Redisplay () |
| static Boolean | SetValues () |
| static void | ClassInitialize () |
| static void | Destroy () |
| static XtGeometryResult | QueryGeometry () |
| static void | SetTextWidthAndHeight (LabelWidget lw) |
| static void | GetnormalGC (LabelWidget lw) |
| static void | GetgrayGC (LabelWidget lw) |
| static void | compute_bitmap_offsets (LabelWidget lw) |
| static void | set_bitmap_info (LabelWidget lw) |
| static void | Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args) |
| static void | Redisplay (Widget gw, XEvent *event, Region region) |
| static void | _Reposition (LabelWidget lw, Dimension width, Dimension height, Position *dx, Position *dy) |
| static void | Resize (Widget w) |
| static Boolean | SetValues (Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args) |
| static void | Destroy (Widget w) |
| static XtGeometryResult | QueryGeometry (Widget w, XtWidgetGeometry *intended, XtWidgetGeometry *preferred) |
Variables | |
| static XtResource | resources [] |
| LabelClassRec | labelClassRec |
| WidgetClass | labelWidgetClass = (WidgetClass)&labelClassRec |
| #define HEIGHT 2 |
| #define MULTI_LINE_LABEL 32767 |
| #define PIXMAP 0 |
| #define TXT16 XChar2b |
| #define WIDTH 1 |
| static void _Reposition | ( | LabelWidget | lw, | |
| Dimension | width, | |||
| Dimension | height, | |||
| Position * | dx, | |||
| Position * | dy | |||
| ) | [static] |
Definition at line 613 of file Label.c.
References int, LEFT_OFFSET, XtJustifyCenter, XtJustifyLeft, and XtJustifyRight.
Referenced by Resize().
00617 { 00618 Position newPos; 00619 Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw) + 00620 lw->threeD.shadow_width; 00621 00622 switch (lw->label.justify) { 00623 00624 case XtJustifyLeft : 00625 newPos = leftedge; 00626 break; 00627 00628 case XtJustifyRight : 00629 newPos = width - 00630 (lw->label.label_width 00631 + lw->label.internal_width 00632 + lw->threeD.shadow_width); 00633 break; 00634 00635 case XtJustifyCenter : 00636 default: 00637 newPos = (int)(width - lw->label.label_width) / 2; 00638 break; 00639 } 00640 if (newPos < (Position)leftedge) 00641 newPos = leftedge; 00642 *dx = newPos - lw->label.label_x; 00643 lw->label.label_x = newPos; 00644 *dy = (newPos = (int)(height - lw->label.label_height) / 2) 00645 - lw->label.label_y; 00646 lw->label.label_y = newPos; 00647 return; 00648 }
Here is the caller graph for this function:

| static void ClassInitialize | ( | ) | [static] |
Definition at line 185 of file Label.c.
References XawInitializeWidgetSet(), XmuCvtStringToJustify(), and XtRJustify.
00186 { 00187 XawInitializeWidgetSet(); 00188 XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, 00189 (XtConvertArgList)NULL, 0 ); 00190 }
Here is the call graph for this function:

| static void compute_bitmap_offsets | ( | LabelWidget | lw | ) | [static] |
Definition at line 411 of file Label.c.
Referenced by Resize(), and set_bitmap_info().
00413 { 00414 /* 00415 * bitmap will be eventually be displayed at 00416 * (internal_width, internal_height + lbm_y) 00417 */ 00418 if (lw->label.lbm_height != 0) { 00419 lw->label.lbm_y = (lw->core.height - 00420 (lw->threeD.shadow_width * 2 + 00421 lw->label.internal_height * 2 + 00422 lw->label.lbm_height)) / 2; 00423 } else { 00424 lw->label.lbm_y = 0; 00425 } 00426 }
Here is the caller graph for this function:

| static void Destroy | ( | Widget | w | ) | [static] |
Definition at line 769 of file Label.c.
References lw, and XmuReleaseStippledPixmap().
00771 { 00772 LabelWidget lw = (LabelWidget)w; 00773 00774 if ( lw->label.label != lw->core.name ) 00775 XtFree( lw->label.label ); 00776 XtReleaseGC( w, lw->label.normal_GC ); 00777 XtReleaseGC( w, lw->label.gray_GC); 00778 XmuReleaseStippledPixmap( XtScreen(w), lw->label.stipple ); 00779 }
Here is the call graph for this function:

| static void Destroy | ( | ) | [static] |
| static void GetgrayGC | ( | LabelWidget | lw | ) | [static] |
Definition at line 380 of file Label.c.
References XmuCreateStippledPixmap().
Referenced by Initialize().
00382 { 00383 XGCValues values; 00384 00385 values.foreground = lw->label.foreground; 00386 values.background = lw->core.background_pixel; 00387 values.font = lw->label.font->fid; 00388 values.fill_style = FillTiled; 00389 values.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw), 00390 lw->label.foreground, 00391 lw->core.background_pixel, 00392 lw->core.depth); 00393 values.graphics_exposures = False; 00394 00395 lw->label.stipple = values.tile; 00396 if ( lw->simple.international == True ) 00397 /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC. */ 00398 lw->label.gray_GC = XtAllocateGC((Widget)lw, 0, 00399 (unsigned) GCForeground | GCBackground | 00400 GCTile | GCFillStyle | 00401 GCGraphicsExposures, 00402 &values, GCFont, 0); 00403 else 00404 lw->label.gray_GC = XtGetGC((Widget)lw, 00405 (unsigned) GCForeground | GCBackground | 00406 GCFont | GCTile | GCFillStyle | 00407 GCGraphicsExposures, 00408 &values); 00409 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void GetnormalGC | ( | LabelWidget | lw | ) | [static] |
Definition at line 357 of file Label.c.
Referenced by Initialize().
00359 { 00360 XGCValues values; 00361 00362 values.foreground = lw->label.foreground; 00363 values.background = lw->core.background_pixel; 00364 values.font = lw->label.font->fid; 00365 values.graphics_exposures = False; 00366 00367 if ( lw->simple.international == True ) 00368 /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC. */ 00369 lw->label.normal_GC = XtAllocateGC( 00370 (Widget)lw, 0, 00371 (unsigned) GCForeground | GCBackground | GCGraphicsExposures, 00372 &values, GCFont, 0 ); 00373 else 00374 lw->label.normal_GC = XtGetGC( 00375 (Widget)lw, 00376 (unsigned) GCForeground | GCBackground | GCFont | GCGraphicsExposures, 00377 &values); 00378 }
Here is the caller graph for this function:

| static void Initialize | ( | Widget | request, | |
| Widget | new, | |||
| ArgList | args, | |||
| Cardinal * | num_args | |||
| ) | [static] |
Definition at line 448 of file Label.c.
References GetgrayGC(), GetnormalGC(), LEFT_OFFSET, lw, set_bitmap_info(), and SetTextWidthAndHeight().
00452 { 00453 LabelWidget lw = (LabelWidget) new; 00454 00455 if (lw->label.label == NULL) 00456 lw->label.label = XtNewString(lw->core.name); 00457 else { 00458 lw->label.label = XtNewString(lw->label.label); 00459 } 00460 00461 GetnormalGC(lw); 00462 GetgrayGC(lw); 00463 00464 SetTextWidthAndHeight(lw); 00465 00466 if (lw->core.height == 0) 00467 lw->core.height = lw->label.label_height + 00468 2 * lw->label.internal_height + 00469 2 * lw->threeD.shadow_width; 00470 00471 set_bitmap_info (lw); /* need core.height */ 00472 00473 if (lw->core.width == 0) /* need label.lbm_width */ 00474 lw->core.width = (lw->label.label_width + 00475 2 * lw->label.internal_width + 00476 2 * lw->threeD.shadow_width + 00477 LEFT_OFFSET(lw)); 00478 00479 lw->label.label_x = lw->label.label_y = 0; 00480 (*XtClass(new)->core_class.resize) ((Widget)lw); 00481 00482 } /* Initialize */
Here is the call graph for this function:

| static void Initialize | ( | ) | [static] |
Definition at line 26 of file javasci_globals.c.
00027 { 00028 static char env[1024]; 00029 static char initstr[]="exec(\"SCI/etc/scilab.start\",-1);quit;"; 00030 static int iflag=-1, stacksize = 1000000, ierr=0; 00031 00032 #ifdef _MSC_VER 00033 static char JavaSciInterf[]="javasci"; 00034 static char nw[]="-nw"; 00035 static char nb[]="-nb"; 00036 #endif 00037 00038 00039 char *p1 = (char*)getenv ("SCI"); 00040 00041 00042 #ifdef _MSC_VER 00043 /* Supprime le mode windows et la baniere */ 00044 add_sci_argv(JavaSciInterf); 00045 add_sci_argv(nb); 00046 #endif 00047 00048 #ifdef _MSC_VER 00049 if ( p1== NULL ) 00050 { 00051 /* Detection Scilab path */ 00052 char modname[MAX_PATH+1]; 00053 if (!GetModuleFileName (GetModuleHandle("javasci.dll"), modname, MAX_PATH)) 00054 { 00055 MessageBox(NULL,"javasci.dll not found","Warning",MB_ICONWARNING); 00056 } 00057 else 00058 { 00059 char *p; 00060 if ((p = strrchr (modname, '\\')) == NULL) exit(1); /* remove \javasci.dll from modname */ 00061 else 00062 { 00063 *p='\0'; 00064 if ((p = strrchr (modname, '\\')) == NULL) exit(1); /* remove \bin from modname */ 00065 else 00066 { 00067 *p='\0'; 00068 set_sci_env(modname); 00069 } 00070 } 00071 } 00072 } 00073 else 00074 { 00075 char *pathSCI=(char*)MALLOC((strlen(p1)+1)*sizeof(char)); 00076 sprintf(pathSCI,"%s",p1); 00077 set_sci_env(pathSCI); 00078 if (pathSCI) {FREE(pathSCI);pathSCI=NULL;} 00079 } 00080 #else 00081 if (p1==NULL) 00082 { 00083 fprintf(stderr,"Please define SCI environment variable\n"); 00084 sprintf (env, "%s=%s", "SCI",SCI); 00085 setSCIpath(SCI); 00086 putenv (env); 00087 } 00088 #endif 00089 /* set TMPDIR */ 00090 C2F(settmpdir)(); 00091 /* Scilab Initialization */ 00092 C2F(inisci)(&iflag,&stacksize,&ierr); 00093 if ( ierr > 0 ) 00094 { 00095 fprintf(stderr,"Scilab initialization failed !\n"); 00096 exit(1); 00097 } 00098 00099 00100 /* Initialisation fenetre graphique */ 00101 #ifdef _MSC_VER 00102 InitWindowGraphDll(); 00103 #endif 00104 00105 /* pour initialisation de la primitive scilab : fromjava() */ 00106 SetFromJavaToON(); 00107 00108 /* Chargement de Scilab.start */ 00109 C2F(scirun)(initstr,(int)strlen(initstr)); 00110 00111 }
| static XtGeometryResult QueryGeometry | ( | Widget | w, | |
| XtWidgetGeometry * | intended, | |||
| XtWidgetGeometry * | preferred | |||
| ) | [static] |
Definition at line 782 of file Label.c.
References LEFT_OFFSET, and lw.
00785 { 00786 LabelWidget lw = (LabelWidget)w; 00787 00788 preferred->request_mode = CWWidth | CWHeight; 00789 preferred->width = (lw->label.label_width + 00790 2 * lw->label.internal_width + 00791 2 * lw->threeD.shadow_width + 00792 LEFT_OFFSET(lw)); 00793 preferred->height = lw->label.label_height + 00794 2 * lw->label.internal_height + 00795 2 * lw->threeD.shadow_width; 00796 if ( ((intended->request_mode & (CWWidth | CWHeight)) 00797 == (CWWidth | CWHeight)) && 00798 intended->width == preferred->width && 00799 intended->height == preferred->height) 00800 return XtGeometryYes; 00801 else if (preferred->width == w->core.width && 00802 preferred->height == w->core.height) 00803 return XtGeometryNo; 00804 else 00805 return XtGeometryAlmost; 00806 }
| static XtGeometryResult QueryGeometry | ( | ) | [static] |
| static void Redisplay | ( | Widget | gw, | |
| XEvent * | event, | |||
| Region | region | |||
| ) | [static] |
Definition at line 489 of file Label.c.
References abs, commandWidgetClass, index, L, label, len, MULTI_LINE_LABEL, nl, ThreeDClassPart::shadowdraw, _LabelClassRec::threeD_class, TXT16, w, and width.
00493 { 00494 extern WidgetClass commandWidgetClass; 00495 LabelWidget w = (LabelWidget) gw; 00496 LabelWidgetClass lwclass = (LabelWidgetClass) XtClass (gw); 00497 GC gc; 00498 00499 /* 00500 * Don't draw shadows if command is going to redraw them. 00501 * The shadow draw method is region aware, but since 99% of 00502 * all labels don't have shadows, we'll check for a shadow 00503 * before we incur the function call overhead. 00504 */ 00505 if (!XtIsSubclass (gw, commandWidgetClass) && w->threeD.shadow_width > 0) 00506 (*lwclass->threeD_class.shadowdraw) (gw, event, region, True); 00507 00508 /* 00509 * now we'll see if we need to draw the rest of the label 00510 */ 00511 if (region != NULL) { 00512 int x = w->label.label_x; 00513 unsigned int width = w->label.label_width; 00514 if (w->label.lbm_width) { 00515 if (w->label.label_x > (x = w->label.internal_width)) 00516 width += w->label.label_x - x; 00517 } 00518 if (XRectInRegion(region, x, w->label.label_y, 00519 width, w->label.label_height) == RectangleOut){ 00520 return; 00521 } 00522 } 00523 00524 gc = XtIsSensitive(gw) ? w->label.normal_GC : w->label.gray_GC; 00525 #ifdef notdef 00526 if (region != NULL) 00527 XSetRegion(XtDisplay(gw), gc, region); 00528 #endif /*notdef*/ 00529 00530 if (w->label.pixmap == None) { 00531 int len = w->label.label_len; 00532 char *label = w->label.label; 00533 Position y = w->label.label_y + w->label.font->max_bounds.ascent; 00534 Position ksy = w->label.label_y; 00535 00536 /* display left bitmap */ 00537 if (w->label.left_bitmap && w->label.lbm_width != 0) { 00538 XCopyPlane (XtDisplay(gw), w->label.left_bitmap, XtWindow(gw), gc, 00539 0, 0, w->label.lbm_width, w->label.lbm_height, 00540 (int) w->label.internal_width 00541 + w->threeD.shadow_width, 00542 (int) w->label.internal_height 00543 + w->threeD.shadow_width 00544 + w->label.lbm_y, 00545 (unsigned long) 1L); 00546 } 00547 00548 if ( w->simple.international == True ) { 00549 00550 XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset); 00551 00552 ksy += abs(ext->max_ink_extent.y); 00553 00554 if (len == MULTI_LINE_LABEL) { 00555 char *nl; 00556 while ((nl = index(label, '\n')) != NULL) { 00557 XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset, gc, 00558 w->label.label_x, ksy, label, (int)(nl - label)); 00559 ksy += ext->max_ink_extent.height; 00560 label = nl + 1; 00561 } 00562 len = strlen(label); 00563 } 00564 if (len) 00565 XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset, gc, 00566 w->label.label_x, ksy, label, len); 00567 00568 } else { /*international false, so use R5 routine */ 00569 00570 if (len == MULTI_LINE_LABEL) { 00571 char *nl; 00572 while ((nl = index(label, '\n')) != NULL) { 00573 if (w->label.encoding) 00574 XDrawString16(XtDisplay(gw), XtWindow(gw), gc, 00575 w->label.label_x, y, 00576 (TXT16*)label, (int)(nl - label)/2); 00577 else 00578 XDrawString(XtDisplay(gw), XtWindow(gw), gc, 00579 w->label.label_x, y, label, (int)(nl - label)); 00580 y += w->label.font->max_bounds.ascent + 00581 w->label.font->max_bounds.descent; 00582 label = nl + 1; 00583 } 00584 len = strlen(label); 00585 } 00586 if (len) { 00587 if (w->label.encoding) 00588 XDrawString16(XtDisplay(gw), XtWindow(gw), gc, 00589 w->label.label_x, y, (TXT16*)label, len/2); 00590 else 00591 XDrawString(XtDisplay(gw), XtWindow(gw), gc, 00592 w->label.label_x, y, label, len); 00593 } 00594 00595 } /*endif international*/ 00596 00597 } else if (w->label.label_len == 1) { /* depth */ 00598 XCopyPlane(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc, 00599 0, 0, w->label.label_width, w->label.label_height, 00600 w->label.label_x, w->label.label_y, 1L); 00601 } else { 00602 XCopyArea(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc, 00603 0, 0, w->label.label_width, w->label.label_height, 00604 w->label.label_x, w->label.label_y); 00605 } 00606 00607 #ifdef notdef 00608 if (region != NULL) 00609 XSetClipMask(XtDisplay(gw), gc, (Pixmap)None); 00610 #endif /* notdef */ 00611 }
| static void Redisplay | ( | ) | [static] |
| static void Resize | ( | Widget | w | ) | [static] |
Definition at line 650 of file Label.c.
References _Reposition(), compute_bitmap_offsets(), dx, dy, and lw.
00652 { 00653 LabelWidget lw = (LabelWidget)w; 00654 Position dx, dy; 00655 00656 _Reposition(lw, w->core.width, w->core.height, &dx, &dy); 00657 compute_bitmap_offsets (lw); 00658 }
Here is the call graph for this function:

| static void Resize | ( | ) | [static] |
| static void set_bitmap_info | ( | LabelWidget | lw | ) | [static] |
Definition at line 429 of file Label.c.
References compute_bitmap_offsets(), depth, and root.
Referenced by Initialize().
00431 { 00432 Window root; 00433 int x, y; 00434 unsigned int bw, depth; 00435 00436 if (!(lw->label.left_bitmap && 00437 XGetGeometry (XtDisplay(lw), lw->label.left_bitmap, &root, &x, &y, 00438 &lw->label.lbm_width, &lw->label.lbm_height, 00439 &bw, &depth))) { 00440 lw->label.lbm_width = lw->label.lbm_height = 0; 00441 } 00442 compute_bitmap_offsets (lw); 00443 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void SetTextWidthAndHeight | ( | LabelWidget | lw | ) | [static] |
Definition at line 253 of file Label.c.
References depth, height, index, label, MULTI_LINE_LABEL, nl, root, TXT16, and width.
Referenced by Initialize().
00255 { 00256 XFontStruct *fs = lw->label.font; 00257 00258 char *nl; 00259 00260 if (lw->label.pixmap != None) { 00261 Window root; 00262 int x, y; 00263 unsigned int width, height, bw, depth; 00264 if (XGetGeometry(XtDisplay(lw), lw->label.pixmap, &root, &x, &y, 00265 &width, &height, &bw, &depth)) { 00266 lw->label.label_height = height; 00267 lw->label.label_width = width; 00268 lw->label.label_len = depth; 00269 return; 00270 } 00271 } 00272 if ( lw->simple.international == True ) { 00273 00274 XFontSet fset = lw->label.fontset; 00275 XFontSetExtents *ext = XExtentsOfFontSet(fset); 00276 00277 lw->label.label_height = ext->max_ink_extent.height; 00278 if (lw->label.label == NULL) { 00279 lw->label.label_len = 0; 00280 lw->label.label_width = 0; 00281 } 00282 else if ((nl = index(lw->label.label, '\n')) != NULL) { 00283 char *label; 00284 lw->label.label_len = MULTI_LINE_LABEL; 00285 lw->label.label_width = 0; 00286 for (label = lw->label.label; nl != NULL; nl = index(label, '\n')) { 00287 int width = XmbTextEscapement(fset, label, (int)(nl - label)); 00288 00289 if (width > (int)lw->label.label_width) 00290 lw->label.label_width = width; 00291 label = nl + 1; 00292 if (*label) 00293 lw->label.label_height += 00294 ext->max_ink_extent.height; 00295 } 00296 if (*label) { 00297 int width = XmbTextEscapement(fset, label, strlen(label)); 00298 00299 if (width > (int) lw->label.label_width) 00300 lw->label.label_width = width; 00301 } 00302 } else { 00303 lw->label.label_len = strlen(lw->label.label); 00304 lw->label.label_width = 00305 XmbTextEscapement(fset, lw->label.label, (int) lw->label.label_len); 00306 } 00307 00308 } else { 00309 00310 lw->label.label_height = fs->max_bounds.ascent + fs->max_bounds.descent; 00311 if (lw->label.label == NULL) { 00312 lw->label.label_len = 0; 00313 lw->label.label_width = 0; 00314 } 00315 else if ((nl = index(lw->label.label, '\n')) != NULL) { 00316 char *label; 00317 lw->label.label_len = MULTI_LINE_LABEL; 00318 lw->label.label_width = 0; 00319 for (label = lw->label.label; nl != NULL; nl = index(label, '\n')) { 00320 int width; 00321 00322 if (lw->label.encoding) 00323 width = XTextWidth16(fs, (TXT16*)label, (int)(nl - label)/2); 00324 else 00325 width = XTextWidth(fs, label, (int)(nl - label)); 00326 if (width > (int)lw->label.label_width) 00327 lw->label.label_width = width; 00328 label = nl + 1; 00329 if (*label) 00330 lw->label.label_height += 00331 fs->max_bounds.ascent + fs->max_bounds.descent; 00332 } 00333 if (*label) { 00334 int width = XTextWidth(fs, label, strlen(label)); 00335 00336 if (lw->label.encoding) 00337 width = XTextWidth16(fs, (TXT16*)label, (int)strlen(label)/2); 00338 else 00339 width = XTextWidth(fs, label, strlen(label)); 00340 if (width > (int) lw->label.label_width) 00341 lw->label.label_width = width; 00342 } 00343 } else { 00344 lw->label.label_len = strlen(lw->label.label); 00345 if (lw->label.encoding) 00346 lw->label.label_width = 00347 XTextWidth16(fs, (TXT16*)lw->label.label, 00348 (int) lw->label.label_len/2); 00349 else 00350 lw->label.label_width = 00351 XTextWidth(fs, lw->label.label, (int) lw->label.label_len); 00352 } 00353 00354 } 00355 }
Here is the caller graph for this function:

| static Boolean SetValues | ( | Widget | current, | |
| Widget | request, | |||
| Widget | new, | |||
| ArgList | args, | |||
| Cardinal * | num_args | |||
| ) | [static] |
Definition at line 669 of file Label.c.
References _LabelRec::core, FALSE, HEIGHT, LabelPart::label, _LabelRec::label, name, NUM_CHECKS, PIXMAP, streq, TRUE, WIDTH, and XtNbitmap.
00673 { 00674 LabelWidget curlw = (LabelWidget) current; 00675 LabelWidget reqlw = (LabelWidget) request; 00676 LabelWidget newlw = (LabelWidget) new; 00677 int i; 00678 Boolean was_resized = False, redisplay = False, checks[NUM_CHECKS]; 00679 00680 for (i = 0; i < NUM_CHECKS; i++) 00681 checks[i] = FALSE; 00682 00683 for (i = 0; i < *num_args; i++) { 00684 if (streq(XtNbitmap, args[i].name)) 00685 checks[PIXMAP] = TRUE; 00686 if (streq(XtNwidth, args[i].name)) 00687 checks[WIDTH] = TRUE; 00688 if (streq(XtNheight, args[i].name)) 00689 checks[HEIGHT] = TRUE; 00690 } 00691 00692 if (newlw->label.label == NULL) { 00693 newlw->label.label = newlw->core.name; 00694 } 00695 00696 /* 00697 * resize on bitmap change 00698 */ 00699 if (curlw->label.left_bitmap != newlw->label.left_bitmap) { 00700 was_resized = True; 00701 } 00702 00703 if (curlw->label.encoding != newlw->label.encoding) 00704 was_resized = True; 00705 00706 if ( (curlw->label.fontset != newlw->label.fontset) && 00707 curlw->simple.international ){ 00708 was_resized = True; 00709 } 00710 if (curlw->label.label != newlw->label.label) { 00711 if (curlw->label.label != curlw->core.name) 00712 XtFree( (char *)curlw->label.label ); 00713 00714 if (newlw->label.label != newlw->core.name) { 00715 newlw->label.label = XtNewString( newlw->label.label ); 00716 } 00717 was_resized = True; 00718 } 00719 00720 if (was_resized || (curlw->label.font != newlw->label.font) || 00721 (curlw->label.justify != newlw->label.justify) || checks[PIXMAP]) { 00722 00723 SetTextWidthAndHeight(newlw); 00724 was_resized = True; 00725 } 00726 00727 /* recalculate the window size if something has changed. */ 00728 if (newlw->label.resize && was_resized) { 00729 if ((curlw->core.height == reqlw->core.height) && !checks[HEIGHT]) 00730 newlw->core.height = (newlw->label.label_height + 00731 2 * newlw->label.internal_height + 00732 2 * newlw->threeD.shadow_width); 00733 00734 set_bitmap_info (newlw); 00735 00736 if ((curlw->core.width == reqlw->core.width) && !checks[WIDTH]) 00737 newlw->core.width = (newlw->label.label_width + 00738 LEFT_OFFSET(newlw) + 00739 2 * newlw->label.internal_width + 00740 2 * newlw->threeD.shadow_width); 00741 } 00742 00743 if (curlw->label.foreground != newlw->label.foreground 00744 || curlw->core.background_pixel != newlw->core.background_pixel 00745 || curlw->label.font->fid != newlw->label.font->fid ) { 00746 00747 /* The Fontset is not in the GC - don't make a new GC if FS changes! */ 00748 00749 XtReleaseGC(new, curlw->label.normal_GC); 00750 XtReleaseGC(new, curlw->label.gray_GC); 00751 XmuReleaseStippledPixmap( XtScreen(current), curlw->label.stipple ); 00752 GetnormalGC(newlw); 00753 GetgrayGC(newlw); 00754 redisplay = True; 00755 } 00756 00757 if ((curlw->label.internal_width != newlw->label.internal_width) 00758 || (curlw->label.internal_height != newlw->label.internal_height) 00759 || was_resized) { 00760 /* Resize() will be called if geometry changes succeed */ 00761 Position dx, dy; 00762 _Reposition(newlw, curlw->core.width, curlw->core.height, &dx, &dy); 00763 } 00764 00765 return was_resized || redisplay || 00766 XtIsSensitive(current) != XtIsSensitive(new); 00767 }
| static Boolean SetValues | ( | ) | [static] |
| WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec |
XtResource resources[] [static] |
Initial value:
{
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
offset(label.foreground), XtRString, XtDefaultForeground},
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
offset(label.font),XtRString, XtDefaultFont},
{XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet ),
offset(label.fontset),XtRString, XtDefaultFontSet},
{XtNlabel, XtCLabel, XtRString, sizeof(String),
offset(label.label), XtRString, NULL},
{XtNencoding, XtCEncoding, XtRUnsignedChar, sizeof(unsigned char),
offset(label.encoding), XtRImmediate, (XtPointer)XawTextEncoding8bit},
{XtNjustify, XtCJustify, XtRJustify, sizeof(XtJustify),
offset(label.justify), XtRImmediate, (XtPointer)XtJustifyCenter},
{XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension),
offset(label.internal_width), XtRImmediate, (XtPointer)4},
{XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension),
offset(label.internal_height), XtRImmediate, (XtPointer)2},
{XtNleftBitmap, XtCLeftBitmap, XtRBitmap, sizeof(Pixmap),
offset(label.left_bitmap), XtRImmediate, (XtPointer) None},
{XtNbitmap, XtCPixmap, XtRBitmap, sizeof(Pixmap),
offset(label.pixmap), XtRImmediate, (XtPointer)None},
{XtNresize, XtCResize, XtRBoolean, sizeof(Boolean),
offset(label.resize), XtRImmediate, (XtPointer)True},
{XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension),
offset(threeD.shadow_width), XtRImmediate, (XtPointer) 0},
{XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
(XtPointer)1}
}
1.5.1