Lines Matching defs:cbw

223 Get_GC(CommandWidget cbw, Pixel fg, Pixel bg)
228 .font = cbw->label.font->fid,
233 if (cbw->command.highlight_thickness > 1)
234 values.line_width = cbw->command.highlight_thickness;
236 if (cbw->simple.international == True)
237 return (XtAllocateGC((Widget)cbw, 0,
241 return (XtGetGC((Widget)cbw,
251 CommandWidget cbw = (CommandWidget)cnew;
254 if (!cbw->label.font) XtError("Aborting: no font found\n");
256 if (cbw->command.shape_style != XawShapeRectangle &&
259 cbw->command.shape_style = XawShapeRectangle;
261 if (cbw->command.highlight_thickness == DEFAULT_SHAPE_HIGHLIGHT) {
262 if (cbw->command.shape_style != XawShapeRectangle)
263 cbw->command.highlight_thickness = 0;
265 cbw->command.highlight_thickness = DEFAULT_HIGHLIGHT_THICKNESS;
268 cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground,
269 cbw->core.background_pixel);
270 cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
271 cbw->label.foreground);
272 XtReleaseGC(cnew, cbw->label.normal_GC);
273 cbw->label.normal_GC = cbw->command.normal_GC;
275 cbw->command.set = False;
276 cbw->command.highlighted = HighlightNone;
280 HighlightRegion(CommandWidget cbw)
285 if (cbw->command.highlight_thickness == 0 ||
286 cbw->command.highlight_thickness > Min(XtWidth(cbw), XtHeight(cbw)) / 2)
297 rect.width = XtWidth(cbw);
298 rect.height = XtHeight(cbw);
300 rect.x = rect.y = (short)cbw->command.highlight_thickness;
301 rect.width = (unsigned short)(rect.width - cbw->command.highlight_thickness * 2);
302 rect.height = (unsigned short)(rect.height - cbw->command.highlight_thickness * 2);
331 CommandWidget cbw = (CommandWidget)w;
333 if (cbw->command.set)
337 cbw->command.set= True;
344 CommandWidget cbw = (CommandWidget)w;
346 if (!cbw->command.set)
349 cbw->command.set = False;
357 CommandWidget cbw = (CommandWidget)w;
359 if (cbw->command.set) {
360 cbw->command.highlighted = HighlightNone;
371 CommandWidget cbw = (CommandWidget)w;
374 cbw->command.highlighted = HighlightWhenUnset;
381 cbw->command.highlighted = HighlightAlways;
384 cbw->command.highlighted = HighlightWhenUnset;
390 PaintCommandWidget(w, event, HighlightRegion(cbw), True);
397 CommandWidget cbw = (CommandWidget)w;
399 cbw->command.highlighted = HighlightNone;
401 PaintCommandWidget(w, event, HighlightRegion(cbw), True);
408 CommandWidget cbw = (CommandWidget)w;
414 if (cbw->command.set)
415 XtCallCallbackList(w, cbw->command.callbacks, (XtPointer) NULL);
435 CommandWidget cbw = (CommandWidget)w;
439 very_thick = cbw->command.highlight_thickness
440 > Min(XtWidth(cbw), XtHeight(cbw)) / 2;
442 if (cbw->command.highlight_thickness == 0) {
451 if (cbw->command.highlighted != HighlightNone) {
452 rev_gc = cbw->command.normal_GC;
455 rev_gc = cbw->command.inverse_GC;
458 if (!((!change && cbw->command.highlighted == HighlightNone)
459 || (cbw->command.highlighted == HighlightWhenUnset
460 && cbw->command.set))) {
463 0, 0, XtWidth(cbw), XtHeight(cbw));
466 if (cbw->core.background_pixmap != XtUnspecifiedPixmap &&
467 rev_gc == cbw->command.inverse_GC) {
469 0, 0, XtWidth(cbw), cbw->command.highlight_thickness,
472 0, cbw->command.highlight_thickness,
473 cbw->command.highlight_thickness,
474 (unsigned)(XtHeight(cbw) - (cbw->command.highlight_thickness<<1)),
477 XtWidth(cbw) - cbw->command.highlight_thickness,
478 cbw->command.highlight_thickness,
479 cbw->command.highlight_thickness,
480 (unsigned)(XtHeight(cbw) - (cbw->command.highlight_thickness<<1)),
483 0, XtHeight(cbw) - cbw->command.highlight_thickness,
484 XtWidth(cbw), cbw->command.highlight_thickness,
488 int offset = cbw->command.highlight_thickness / 2;
491 (unsigned)(XtWidth(cbw) - cbw->command.highlight_thickness),
492 (unsigned)(XtHeight(cbw) - cbw->command.highlight_thickness));
503 CommandWidget cbw = (CommandWidget)w;
505 /* Label will release cbw->command.normal_GC */
506 XtReleaseGC(w, cbw->command.inverse_GC);
515 CommandWidget cbw = (CommandWidget)cnew;
518 if (oldcbw->core.sensitive != cbw->core.sensitive && !cbw->core.sensitive) {
519 cbw->command.highlighted = HighlightNone;
523 if (cbw->command.set) {
531 background = cbw->label.foreground;
533 foreground = cbw->core.background_pixel;
535 cbw->label.foreground = foreground;
536 cbw->core.background_pixel = background;
539 if (oldcbw->label.foreground != cbw->label.foreground
540 || oldcbw->core.background_pixel != cbw->core.background_pixel
542 != cbw->command.highlight_thickness
543 || oldcbw->label.font != cbw->label.font) {
544 XtReleaseGC(cnew, cbw->command.inverse_GC);
546 cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground,
547 cbw->core.background_pixel);
548 cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
549 cbw->label.foreground);
550 XtReleaseGC(cnew, cbw->label.normal_GC);
551 cbw->label.normal_GC = cbw->command.normal_GC;
557 && oldcbw->command.shape_style != cbw->command.shape_style
558 && !ShapeButton(cbw, True))
559 cbw->command.shape_style = oldcbw->command.shape_style;
567 CommandWidget cbw = (CommandWidget)w;
572 *((String*)args[i].value) = cbw->command.set ?
573 (String)cbw->core.background_pixel : (String)cbw->label.foreground;
575 *((String*)args[i].value) = cbw->command.set ?
576 (String)cbw->label.foreground : (String)cbw->core.background_pixel;
591 ShapeButton(CommandWidget cbw, Bool checkRectangular)
595 if (cbw->command.shape_style == XawShapeRoundedRectangle) {
596 corner_size = XtWidth(cbw) < XtHeight(cbw) ?
597 XtWidth(cbw) : XtHeight(cbw);
598 corner_size = (Dimension)((corner_size * cbw->command.corner_round) / 100);
601 if (checkRectangular || cbw->command.shape_style != XawShapeRectangle) {
602 if (!XmuReshapeWidget((Widget)cbw, cbw->command.shape_style,
604 cbw->command.shape_style = XawShapeRectangle;
633 CommandWidget cbw = (CommandWidget)w;
645 if (cbw->simple.insensitive_border == None)
646 cbw->simple.insensitive_border =
649 cbw->command.set ?
650 cbw->label.foreground :
654 cbw->simple.insensitive_border);