Lines Matching defs:lw
284 SetTextWidthAndHeight(LabelWidget lw)
286 XFontStruct *fs = lw->label.font;
289 if (lw->label.pixmap != None) {
294 if (XGetGeometry(XtDisplay(lw), lw->label.pixmap, &root, &x, &y,
296 lw->label.label_height = (Dimension)height;
297 lw->label.label_width = (Dimension)width;
298 lw->label.label_len = (Dimension)depth;
302 if (lw->simple.international == True) {
303 XFontSet fset = lw->label.fontset;
306 lw->label.label_height = ext->max_ink_extent.height;
307 if (lw->label.label == NULL) {
308 lw->label.label_len = 0;
309 lw->label.label_width = 0;
311 else if ((nl = strchr(lw->label.label, '\n')) != NULL) {
314 lw->label.label_len = MULTI_LINE_LABEL;
315 lw->label.label_width = 0;
316 for (label = lw->label.label; nl != NULL; nl = strchr(label, '\n')) {
319 if (width > (int)lw->label.label_width)
320 lw->label.label_width = (Dimension)width;
323 lw->label.label_height = (Dimension)(lw->label.label_height + ext->max_ink_extent.height);
328 if (width > (int)lw->label.label_width)
329 lw->label.label_width = (Dimension)width;
333 lw->label.label_len = (Dimension)strlen(lw->label.label);
334 lw->label.label_width =
335 (Dimension)XmbTextEscapement(fset, lw->label.label, lw->label.label_len);
339 lw->label.label_height = (Dimension)(fs->max_bounds.ascent + fs->max_bounds.descent);
340 if (lw->label.label == NULL) {
341 lw->label.label_len = 0;
342 lw->label.label_width = 0;
344 else if ((nl = strchr(lw->label.label, '\n')) != NULL) {
347 lw->label.label_len = MULTI_LINE_LABEL;
348 lw->label.label_width = 0;
349 for (label = lw->label.label; nl != NULL; nl = strchr(label, '\n')) {
352 if (lw->label.encoding)
356 if (width > (int)lw->label.label_width)
357 lw->label.label_width = (Dimension)width;
360 lw->label.label_height +=
366 if (lw->label.encoding)
370 if (width > (int) lw->label.label_width)
371 lw->label.label_width = (Dimension)width;
375 lw->label.label_len = (Dimension)strlen(lw->label.label);
376 if (lw->label.encoding)
377 lw->label.label_width =
378 (Dimension)XTextWidth16(fs, (XChar2b *)lw->label.label,
379 (int)lw->label.label_len / 2);
381 lw->label.label_width =
382 (Dimension)XTextWidth(fs, lw->label.label, (int)lw->label.label_len);
388 GetNormalGC(LabelWidget lw)
391 .foreground = lw->label.foreground,
392 .background = lw->core.background_pixel,
393 .font = lw->label.font->fid,
397 if (lw->simple.international == True)
399 lw->label.normal_GC = XtAllocateGC((Widget)lw, 0,
404 lw->label.normal_GC = XtGetGC((Widget)lw,
410 GetGrayGC(LabelWidget lw)
413 .foreground = lw->label.foreground,
414 .background = lw->core.background_pixel,
415 .font = lw->label.font->fid,
417 .tile = XmuCreateStippledPixmap(XtScreen((Widget)lw),
418 lw->label.foreground,
419 lw->core.background_pixel,
420 lw->core.depth),
424 lw->label.stipple = values.tile;
425 if (lw->simple.international == True)
427 lw->label.gray_GC = XtAllocateGC((Widget)lw, 0,
433 lw->label.gray_GC = XtGetGC((Widget)lw,
441 compute_bitmap_offsets(LabelWidget lw)
447 if (lw->label.lbm_height != 0)
448 lw->label.lbm_y = (int)((XtHeight(lw)
449 - ((lw->label.internal_height * 2)
450 + lw->label.lbm_height)) / 2);
452 lw->label.lbm_y = 0;
456 set_bitmap_info(LabelWidget lw)
462 if (!(lw->label.left_bitmap
463 && XGetGeometry(XtDisplay(lw), lw->label.left_bitmap, &root, &x, &y,
464 &lw->label.lbm_width, &lw->label.lbm_height,
466 lw->label.lbm_width = lw->label.lbm_height = 0;
468 compute_bitmap_offsets(lw);
476 LabelWidget lw = (LabelWidget)cnew;
478 if (!lw->label.font) XtError("Aborting: no font found\n");
479 if (lw->simple.international && !lw->label.fontset)
482 if (lw->label.label == NULL)
483 lw->label.label = XtNewString(lw->core.name);
485 lw->label.label = XtNewString(lw->label.label);
487 GetNormalGC(lw);
488 GetGrayGC(lw);
490 SetTextWidthAndHeight(lw);
492 if (XtHeight(lw) == 0)
493 XtHeight(lw) = (Dimension)(lw->label.label_height + 2 * lw->label.internal_height);
495 set_bitmap_info(lw); /* need core.height */
497 if (XtWidth(lw) == 0) /* need label.lbm_width */
498 XtWidth(lw) = (Dimension)(lw->label.label_width
499 + (unsigned)(2 * lw->label.internal_width)
500 + LEFT_OFFSET(lw));
502 lw->label.label_x = lw->label.label_y = 0;
503 (*XtClass(cnew)->core_class.resize)((Widget)lw);
591 _Reposition(LabelWidget lw, unsigned int width, unsigned int height,
595 Position leftedge = (Position)(lw->label.internal_width + LEFT_OFFSET(lw));
597 switch (lw->label.justify) {
602 newPos = (Position)(width - (unsigned)(lw->label.label_width + lw->label.internal_width));
607 newPos = (Position)((int)(width - lw->label.label_width) >> 1);
612 *dx = (Position)(newPos - lw->label.label_x);
613 lw->label.label_x = newPos;
615 newPos = (Position)((height - lw->label.label_height) >> 1);
616 *dy = (Position)(newPos - lw->label.label_y);
617 lw->label.label_y = newPos;
623 LabelWidget lw = (LabelWidget)w;
626 _Reposition(lw, XtWidth(w), XtHeight(w), &dx, &dy);
627 compute_bitmap_offsets(lw);
734 LabelWidget lw = (LabelWidget)w;
736 if (lw->label.label != lw->core.name)
737 XtFree(lw->label.label);
738 XtReleaseGC(w, lw->label.normal_GC);
739 XtReleaseGC(w, lw->label.gray_GC);
740 XmuReleaseStippledPixmap(XtScreen(w), lw->label.stipple);
747 LabelWidget lw = (LabelWidget)w;
750 preferred->width = (Dimension)(lw->label.label_width
751 + (unsigned)(lw->label.internal_width << 1)
752 + LEFT_OFFSET(lw));
753 preferred->height = (Dimension)(lw->label.label_height +
754 (lw->label.internal_height << 1));