| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | #ifdef HAVE_CONFIG_H1 |
| 49 | #include <config.h> |
| 50 | #endif |
| 51 | #include <X11/IntrinsicP.h> |
| 52 | #include <X11/StringDefs.h> |
| 53 | #include <X11/Xmu/Misc.h> |
| 54 | #include <X11/Xaw/BoxP.h> |
| 55 | #include <X11/Xaw/XawInit.h> |
| 56 | #include "Private.h" |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | static void XawBoxChangeManaged(Widget); |
| 62 | static void XawBoxClassInitialize(void); |
| 63 | #ifndef OLDXAW1 |
| 64 | static void XawBoxExpose(Widget, XEvent*, Region); |
| 65 | #endif |
| 66 | static XtGeometryResult XawBoxGeometryManager(Widget, XtWidgetGeometry*, |
| 67 | XtWidgetGeometry*); |
| 68 | static void XawBoxInitialize(Widget, Widget, ArgList, Cardinal*); |
| 69 | static XtGeometryResult XawBoxQueryGeometry(Widget, XtWidgetGeometry*, |
| 70 | XtWidgetGeometry*); |
| 71 | static void XawBoxRealize(Widget, Mask*, XSetWindowAttributes*); |
| 72 | static void XawBoxResize(Widget); |
| 73 | static Boolean XawBoxSetValues(Widget, Widget, Widget, |
| 74 | ArgList, Cardinal*); |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | static void DoLayout(BoxWidget, unsigned int, unsigned int, |
| 80 | Dimension*, Dimension*, Boolint); |
| 81 | static Boolint TryNewLayout(BoxWidget); |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | #ifndef OLDXAW1 |
| 87 | static XtActionsRec actions[] = { |
| 88 | {"set-values", XawSetValuesAction}, |
| 89 | {"get-values", XawGetValuesAction}, |
| 90 | {"declare", XawDeclareAction}, |
| 91 | {"call-proc", XawCallProcAction}, |
| 92 | }; |
| 93 | #endif |
| 94 | |
| 95 | static XtResource resources[] = { |
| 96 | { |
| 97 | XtNhSpace((char*)&XtStrings[251]), |
| 98 | XtCHSpace((char*)&XtStrings[1058]), |
| 99 | XtRDimension((char*)&XtStrings[1618]), |
| 100 | sizeof(Dimension), |
| 101 | XtOffsetOf(BoxRec, box.h_space)__builtin_offsetof(BoxRec, box.h_space), |
| 102 | XtRImmediate((char*)&XtStrings[1695]), |
| 103 | (XtPointer)4 |
| 104 | }, |
| 105 | { |
| 106 | XtNvSpace((char*)&XtStrings[865]), |
| 107 | XtCVSpace((char*)&XtStrings[1503]), |
| 108 | XtRDimension((char*)&XtStrings[1618]), |
| 109 | sizeof(Dimension), |
| 110 | XtOffsetOf(BoxRec, box.v_space)__builtin_offsetof(BoxRec, box.v_space), |
| 111 | XtRImmediate((char*)&XtStrings[1695]), |
| 112 | (XtPointer)4 |
| 113 | }, |
| 114 | { |
| 115 | XtNorientation((char*)&XtStrings[505]), |
| 116 | XtCOrientation((char*)&XtStrings[1206]), |
| 117 | XtROrientation((char*)&XtStrings[1742]), |
| 118 | sizeof(XtOrientation), |
| 119 | XtOffsetOf(BoxRec, box.orientation)__builtin_offsetof(BoxRec, box.orientation), |
| 120 | XtRImmediate((char*)&XtStrings[1695]), |
| 121 | (XtPointer)XtorientVertical |
| 122 | }, |
| 123 | #ifndef OLDXAW1 |
| 124 | { |
| 125 | XawNdisplayList, |
| 126 | XawCDisplayList, |
| 127 | XawRDisplayList, |
| 128 | sizeof(XawDisplayList*), |
| 129 | XtOffsetOf(BoxRec, box.display_list)__builtin_offsetof(BoxRec, box.display_list), |
| 130 | XtRImmediate((char*)&XtStrings[1695]), |
| 131 | NULL((void*)0) |
| 132 | }, |
| 133 | #endif |
| 134 | }; |
| 135 | |
| 136 | BoxClassRec boxClassRec = { |
| 137 | |
| 138 | { |
| 139 | (WidgetClass)&compositeClassRec, |
| 140 | "Box", |
| 141 | sizeof(BoxRec), |
| 142 | XawBoxClassInitialize, |
| 143 | NULL((void*)0), |
| 144 | False0, |
| 145 | XawBoxInitialize, |
| 146 | NULL((void*)0), |
| 147 | XawBoxRealize, |
| 148 | #ifndef OLDXAW1 |
| 149 | actions, |
| 150 | XtNumber(actions)((Cardinal) (sizeof(actions) / sizeof(actions[0]))), |
| 151 | #else |
| 152 | NULL((void*)0), |
| 153 | 0, |
| 154 | #endif |
| 155 | resources, |
| 156 | XtNumber(resources)((Cardinal) (sizeof(resources) / sizeof(resources[0]))), |
| 157 | NULLQUARK((XrmQuark) 0), |
| 158 | True1, |
| 159 | True1, |
| 160 | True1, |
| 161 | False0, |
| 162 | NULL((void*)0), |
| 163 | XawBoxResize, |
| 164 | #ifndef OLDXAW1 |
| 165 | XawBoxExpose, |
| 166 | #else |
| 167 | NULL((void*)0), |
| 168 | #endif |
| 169 | XawBoxSetValues, |
| 170 | NULL((void*)0), |
| 171 | XtInheritSetValuesAlmost((XtAlmostProc) _XtInherit), |
| 172 | NULL((void*)0), |
| 173 | NULL((void*)0), |
| 174 | XtVersion(11 * 1000 + 6), |
| 175 | NULL((void*)0), |
| 176 | NULL((void*)0), |
| 177 | XawBoxQueryGeometry, |
| 178 | XtInheritDisplayAccelerator((XtStringProc) _XtInherit), |
| 179 | NULL((void*)0), |
| 180 | }, |
| 181 | |
| 182 | { |
| 183 | XawBoxGeometryManager, |
| 184 | XawBoxChangeManaged, |
| 185 | XtInheritInsertChild((XtWidgetProc) _XtInherit), |
| 186 | XtInheritDeleteChild((XtWidgetProc) _XtInherit), |
| 187 | NULL((void*)0), |
| 188 | }, |
| 189 | |
| 190 | { |
| 191 | NULL((void*)0), |
| 192 | }, |
| 193 | }; |
| 194 | |
| 195 | WidgetClass boxWidgetClass = (WidgetClass)&boxClassRec; |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | static void |
| 202 | DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, |
| 203 | Dimension *reply_width, Dimension *reply_height, Boolint position) |
| 204 | { |
| 205 | Boolean vbox = (bbw->box.orientation == XtorientVertical); |
| 206 | Cardinal i; |
| 207 | Dimension w, h; |
| 208 | Dimension lw, lh; |
| 209 | Dimension bw, bh; |
| 210 | Dimension h_space; |
| 211 | Widget widget; |
| 212 | unsigned int num_mapped_children = 0; |
| 213 | |
| 214 | |
| 215 | h_space = bbw->box.h_space; |
| 216 | |
| 217 | w = 0; |
| 218 | for (i = 0; i < bbw->composite.num_children; i++) { |
| 219 | if (XtIsManaged(bbw->composite.children[i]) |
| 220 | && bbw->composite.children[i]->core.width > w) |
| 221 | w = bbw->composite.children[i]->core.width; |
| 222 | } |
| 223 | w += h_space; |
| 224 | if (w > width) |
| 225 | width = w; |
| 226 | h = bbw->box.v_space; |
| 227 | |
| 228 | |
| 229 | lh = 0; |
| 230 | lw = h_space; |
| 231 | |
| 232 | for (i = 0; i < bbw->composite.num_children; i++) { |
| 233 | widget = bbw->composite.children[i]; |
| 234 | if (widget->core.managed) { |
| 235 | if (widget->core.mapped_when_managed) |
| 236 | num_mapped_children++; |
| 237 | |
| 238 | bw = XtWidth(widget)(((RectObj)widget)->rectangle.width) + (XtBorderWidth(widget)(((RectObj)widget)->rectangle.border_width)<<1) + h_space; |
| 239 | if ((Dimension)(lw + bw) > width) { |
| 240 | if (lw > h_space) { |
| 241 | |
| 242 | |
| 243 | |
| 244 | AssignMax(w, lw){if ((lw) > (w)) w = (lw);}; |
| 245 | if (vbox) { |
| 246 | h += lh + bbw->box.v_space; |
| 247 | lh = 0; |
| 248 | lw = h_space; |
| 249 | } |
| 250 | } |
| 251 | else if (!position) { |
| 252 | |
| 253 | DoLayout(bbw, (unsigned)(lw + bw), height, reply_width, |
| 254 | reply_height, position); |
| 255 | return; |
| 256 | } |
| 257 | } |
| 258 | if (position && (lw != XtX(widget)(((RectObj)widget)->rectangle.x) || h != XtY(widget)(((RectObj)widget)->rectangle.y))) { |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | if (XtIsRealized(widget)(XtWindowOfObject(widget) != 0L) && widget->core.mapped_when_managed) |
| 272 | XUnmapWindow( XtDisplay(widget)(((widget)->core.screen)->display), XtWindow(widget)((widget)->core.window)); |
| 273 | XtMoveWidget(widget, (int)lw, (int)h); |
| 274 | } |
| 275 | lw += bw; |
| 276 | bh = XtHeight(widget)(((RectObj)widget)->rectangle.height) + (XtBorderWidth(widget)(((RectObj)widget)->rectangle.border_width) << 1); |
| 277 | AssignMax(lh, bh){if ((bh) > (lh)) lh = (bh);}; |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | if (!vbox && width && lw > width && lh < height) { |
| 282 | |
| 283 | Dimension sw = lw, sh = lh; |
| 284 | Dimension width_needed = width; |
| 285 | XtOrientation orientation = bbw->box.orientation; |
| 286 | |
| 287 | bbw->box.orientation = XtorientVertical; |
| 288 | while (sh < height && sw > width) { |
| 289 | width_needed = sw; |
| 290 | DoLayout(bbw, (unsigned)(sw-1), height, &sw, &sh, False0); |
| 291 | } |
| 292 | if (sh < height) |
| 293 | width_needed = sw; |
| 294 | if (width_needed != lw) { |
| 295 | DoLayout(bbw, width_needed, height, |
| 296 | reply_width, reply_height, position); |
| 297 | bbw->box.orientation = orientation; |
| 298 | return; |
| 299 | } |
| 300 | bbw->box.orientation = orientation; |
| 301 | } |
| 302 | if (vbox && (width < w || width < lw)) { |
| 303 | AssignMax(w, lw){if ((lw) > (w)) w = (lw);}; |
| 304 | DoLayout(bbw, w, height, reply_width, reply_height, position); |
| 305 | return; |
| 306 | } |
| 307 | if (position && XtIsRealized((Widget)bbw)(XtWindowOfObject((Widget)bbw) != 0L)) { |
| 308 | if (bbw->composite.num_children == num_mapped_children) |
| 309 | XMapSubwindows(XtDisplay((Widget)bbw)((((Widget)bbw)->core.screen)->display), XtWindow((Widget)bbw)(((Widget)bbw)->core.window)); |
| 310 | else { |
| 311 | int ii = bbw->composite.num_children; |
| 312 | Widget *childP = bbw->composite.children; |
| 313 | |
| 314 | for (; ii > 0; childP++, ii--) |
| 315 | if (XtIsRealized(*childP)(XtWindowOfObject(*childP) != 0L) && XtIsManaged(*childP) |
| 316 | && (*childP)->core.mapped_when_managed) |
| 317 | XtMapWidget(*childP)XMapWindow((((*childP)->core.screen)->display), ((*childP )->core.window)); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | |
| 322 | if (lw > h_space) { |
| 323 | AssignMax(w, lw){if ((lw) > (w)) w = (lw);}; |
| 324 | h += lh + bbw->box.v_space; |
| 325 | } |
| 326 | |
| 327 | *reply_width = Max(w, 1)(((w) > (1)) ? (w) : (1)); |
| 328 | *reply_height = Max(h, 1)(((h) > (1)) ? (h) : (1)); |
| 329 | } |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | static XtGeometryResult |
| 335 | XawBoxQueryGeometry(Widget widget, XtWidgetGeometry *constraint, |
| 336 | XtWidgetGeometry *preferred) |
| 337 | { |
| 338 | BoxWidget w = (BoxWidget)widget; |
| 339 | Dimension width; |
| 340 | Dimension preferred_width = w->box.preferred_width; |
| 341 | Dimension preferred_height = w->box.preferred_height; |
| 342 | |
| 343 | constraint->request_mode &= CWWidth(1<<2) | CWHeight(1<<3); |
| 344 | |
| 345 | if (constraint->request_mode == 0) |
| |
| 346 | |
| 347 | return (XtGeometryYes); |
| 348 | |
| 349 | if (constraint->request_mode == w->box.last_query_mode |
| 350 | && (!(constraint->request_mode & CWWidth(1<<2)) |
| 351 | || constraint->width == w->box.last_query_width) |
| 352 | && (!(constraint->request_mode & CWHeight(1<<3)) |
| 353 | || constraint->height == w->box.last_query_height)) { |
| 354 | |
| 355 | preferred->request_mode = CWWidth(1<<2) | CWHeight(1<<3); |
| 356 | preferred->width = preferred_width; |
| 357 | preferred->height = preferred_height; |
| 358 | if (constraint->request_mode == (CWWidth(1<<2) | CWHeight(1<<3)) |
| 359 | && constraint->width == preferred_width |
| 360 | && constraint->height == preferred_height) |
| 361 | return (XtGeometryYes); |
| 362 | else |
| 363 | return (XtGeometryAlmost); |
| 364 | } |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | w->box.last_query_mode = constraint->request_mode; |
| 372 | w->box.last_query_width = constraint->width; |
| 10 | | Assigned value is garbage or undefined |
|
| 373 | w->box.last_query_height= constraint->height; |
| 374 | |
| 375 | if (constraint->request_mode & CWWidth(1<<2)) |
| 376 | width = constraint->width; |
| 377 | else { |
| 378 | |
| 379 | width = 0; |
| 380 | constraint->width = 65535; |
| 381 | } |
| 382 | |
| 383 | |
| 384 | |
| 385 | |
| 386 | |
| 387 | DoLayout(w, width, 0, &preferred_width, &preferred_height, False0); |
| 388 | |
| 389 | if (constraint->request_mode & CWHeight(1<<3) |
| 390 | && preferred_height > constraint->height) { |
| 391 | |
| 392 | if (preferred_width <= constraint->width) { |
| 393 | width = preferred_width; |
| 394 | do { |
| 395 | if (width > (constraint->width >> 1)) |
| 396 | width = constraint->width; |
| 397 | else |
| 398 | width <<= 1; |
| 399 | DoLayout(w, width, 0, &preferred_width, &preferred_height, False0); |
| 400 | } while (preferred_height > constraint->height |
| 401 | && width < constraint->width); |
| 402 | if (width != constraint->width) { |
| 403 | do { |
| 404 | width = preferred_width; |
| 405 | DoLayout(w, (unsigned)(preferred_width - 1), 0, |
| 406 | &preferred_width, &preferred_height, False0); |
| 407 | } while (preferred_height < constraint->height); |
| 408 | |
| 409 | DoLayout(w, width, 0, &preferred_width, &preferred_height, False0); |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | preferred->request_mode = CWWidth(1<<2) | CWHeight(1<<3); |
| 415 | preferred->width = w->box.preferred_width = preferred_width; |
| 416 | preferred->height = w->box.preferred_height = preferred_height; |
| 417 | |
| 418 | if (constraint->request_mode == (CWWidth(1<<2)|CWHeight(1<<3)) |
| 419 | && constraint->width == preferred_width |
| 420 | && constraint->height == preferred_height) |
| 421 | return (XtGeometryYes); |
| 422 | |
| 423 | return (XtGeometryAlmost); |
| 424 | } |
| 425 | |
| 426 | |
| 427 | |
| 428 | |
| 429 | static void |
| 430 | XawBoxResize(Widget w) |
| 431 | { |
| 432 | Dimension tmp; |
| 433 | |
| 434 | DoLayout((BoxWidget)w, XtWidth(w)(((RectObj)w)->rectangle.width), XtHeight(w)(((RectObj)w)->rectangle.height), &tmp, &tmp, True1); |
| 435 | } |
| 436 | |
| 437 | |
| 438 | |
| 439 | |
| 440 | |
| 441 | |
| 442 | |
| 443 | |
| 444 | static Boolint |
| 445 | TryNewLayout(BoxWidget bbw) |
| 446 | { |
| 447 | Dimension preferred_width, preferred_height; |
| 448 | Dimension proposed_width, proposed_height; |
| 449 | int iterations; |
| 450 | |
| 451 | DoLayout(bbw, bbw->core.width, bbw->core.height, |
| 452 | &preferred_width, &preferred_height, False0); |
| 453 | |
| 454 | |
| 455 | |
| 456 | |
| 457 | |
| 458 | if (XtWidth(bbw)(((RectObj)bbw)->rectangle.width) == preferred_width && XtHeight(bbw)(((RectObj)bbw)->rectangle.height) == preferred_height) |
| 459 | return (True1); |
| 460 | |
| 461 | |
| 462 | iterations = 0; |
| 463 | proposed_width = preferred_width; |
| 464 | proposed_height = preferred_height; |
| 465 | do { |
| 466 | switch (XtMakeResizeRequest((Widget)bbw,proposed_width,proposed_height, |
| 6 | | Control jumps to 'case XtGeometryAlmost:' at line 480 | |
|
| 467 | &proposed_width, &proposed_height)) { |
| 468 | case XtGeometryYes: |
| 469 | return (True1); |
| 470 | case XtGeometryNo: |
| 471 | if (iterations > 0) |
| 472 | |
| 473 | DoLayout(bbw, bbw->core.width, bbw->core.height, |
| 474 | &preferred_width, &preferred_height, False0); |
| 475 | if (preferred_width <= XtWidth(bbw)(((RectObj)bbw)->rectangle.width) |
| 476 | && preferred_height <= XtHeight(bbw)(((RectObj)bbw)->rectangle.height)) |
| 477 | return (True1); |
| 478 | else |
| 479 | return (False0); |
| 480 | case XtGeometryAlmost: |
| 481 | if (proposed_height >= preferred_height && |
| 482 | proposed_width >= preferred_width) { |
| 483 | |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | (void)XtMakeResizeRequest((Widget)bbw, |
| 490 | proposed_width, proposed_height, |
| 491 | &proposed_width, &proposed_height); |
| 492 | return (True1); |
| 493 | } |
| 494 | else if (proposed_width != preferred_width) { |
| |
| 495 | |
| 496 | DoLayout(bbw, proposed_width, 0, |
| 497 | &preferred_width, &preferred_height, False0); |
| 498 | proposed_height = preferred_height; |
| 499 | } |
| 500 | else { |
| 501 | XtWidgetGeometry constraints, reply; |
| 502 | |
| 503 | constraints.request_mode = CWHeight(1<<3); |
| 504 | constraints.height = proposed_height; |
| 505 | (void)XawBoxQueryGeometry((Widget)bbw, &constraints, &reply); |
| 8 | | Calling 'XawBoxQueryGeometry' | |
|
| 506 | proposed_width = preferred_width; |
| 507 | } |
| 508 | |
| 509 | default: |
| 510 | break; |
| 511 | } |
| 512 | iterations++; |
| 513 | } while (iterations < 10); |
| 514 | |
| 515 | return (False0); |
| 516 | } |
| 517 | |
| 518 | |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | |
| 524 | static XtGeometryResult |
| 525 | XawBoxGeometryManager(Widget w, XtWidgetGeometry *request, |
| 526 | XtWidgetGeometry *reply) |
| 527 | { |
| 528 | Dimension width, height, borderWidth; |
| 529 | BoxWidget bbw; |
| 530 | |
| 531 | |
| 532 | if (((request->request_mode & CWX(1<<0)) && request->x != XtX(w)(((RectObj)w)->rectangle.x)) |
| 533 | || ((request->request_mode & CWY(1<<1)) && request->y != XtY(w)(((RectObj)w)->rectangle.y))) |
| 534 | return (XtGeometryNo); |
| 535 | |
| 536 | |
| 537 | if (request->request_mode & (CWWidth(1<<2) | CWHeight(1<<3) | CWBorderWidth(1<<4))) { |
| |
| 538 | |
| 539 | if ((request->request_mode & CWWidth(1<<2)) == 0) |
| |
| 540 | request->width = XtWidth(w)(((RectObj)w)->rectangle.width); |
| 541 | if ((request->request_mode & CWHeight(1<<3)) == 0) |
| |
| 542 | request->height = XtHeight(w)(((RectObj)w)->rectangle.height); |
| 543 | if ((request->request_mode & CWBorderWidth(1<<4)) == 0) |
| |
| 544 | request->border_width = XtBorderWidth(w)(((RectObj)w)->rectangle.border_width); |
| 545 | |
| 546 | |
| 547 | width = XtWidth(w)(((RectObj)w)->rectangle.width); |
| 548 | height = XtHeight(w)(((RectObj)w)->rectangle.height); |
| 549 | borderWidth = XtBorderWidth(w)(((RectObj)w)->rectangle.border_width); |
| 550 | XtWidth(w)(((RectObj)w)->rectangle.width) = request->width; |
| 551 | XtHeight(w)(((RectObj)w)->rectangle.height) = request->height; |
| 552 | XtBorderWidth(w)(((RectObj)w)->rectangle.border_width) = request->border_width; |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | bbw = (BoxWidget) w->core.parent; |
| 561 | |
| 562 | if (TryNewLayout(bbw)) { |
| |
| 563 | |
| 564 | (*XtClass((Widget)bbw)(((Widget)bbw)->core.widget_class)->core_class.resize)((Widget)bbw); |
| 565 | return (XtGeometryYes); |
| 566 | } |
| 567 | else { |
| 568 | |
| 569 | XtWidth(w)(((RectObj)w)->rectangle.width) = width; |
| 570 | XtHeight(w)(((RectObj)w)->rectangle.height) = height; |
| 571 | XtBorderWidth(w)(((RectObj)w)->rectangle.border_width) = borderWidth; |
| 572 | return (XtGeometryNo); |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | |
| 577 | return (XtGeometryYes); |
| 578 | } |
| 579 | |
| 580 | static void |
| 581 | XawBoxChangeManaged(Widget w) |
| 582 | { |
| 583 | |
| 584 | (void)TryNewLayout((BoxWidget)w); |
| 585 | XawBoxResize(w); |
| 586 | } |
| 587 | |
| 588 | static void |
| 589 | XawBoxClassInitialize(void) |
| 590 | { |
| 591 | XawInitializeWidgetSet(); |
| 592 | XtAddConverter(XtRString((char*)&XtStrings[1797]), XtROrientation((char*)&XtStrings[1742]), XmuCvtStringToOrientation, |
| 593 | NULL((void*)0), 0); |
| 594 | XtSetTypeConverter(XtROrientation((char*)&XtStrings[1742]), XtRString((char*)&XtStrings[1797]), XmuCvtOrientationToString, |
| 595 | NULL((void*)0), 0, XtCacheNone0x001, NULL((void*)0)); |
| 596 | } |
| 597 | |
| 598 | |
| 599 | static void |
| 600 | XawBoxInitialize(Widget request, Widget cnew, |
| 601 | ArgList args, Cardinal *num_args) |
| 602 | { |
| 603 | BoxWidget newbbw = (BoxWidget)cnew; |
| 604 | |
| 605 | newbbw->box.last_query_mode = CWWidth(1<<2) | CWHeight(1<<3); |
| 606 | newbbw->box.last_query_width = newbbw->box.last_query_height = 0; |
| 607 | newbbw->box.preferred_width = Max(newbbw->box.h_space, 1)(((newbbw->box.h_space) > (1)) ? (newbbw->box.h_space ) : (1)); |
| 608 | newbbw->box.preferred_height = Max(newbbw->box.v_space, 1)(((newbbw->box.v_space) > (1)) ? (newbbw->box.v_space ) : (1)); |
| 609 | |
| 610 | if (XtWidth(newbbw)(((RectObj)newbbw)->rectangle.width) == 0) |
| 611 | XtWidth(newbbw)(((RectObj)newbbw)->rectangle.width) = newbbw->box.preferred_width; |
| 612 | |
| 613 | if (XtHeight(newbbw)(((RectObj)newbbw)->rectangle.height) == 0) |
| 614 | XtHeight(newbbw)(((RectObj)newbbw)->rectangle.height) = newbbw->box.preferred_height; |
| 615 | } |
| 616 | |
| 617 | static void |
| 618 | XawBoxRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes) |
| 619 | { |
| 620 | #ifndef OLDXAW1 |
| 621 | XawPixmap *pixmap; |
| 622 | #endif |
| 623 | |
| 624 | XtCreateWindow(w, InputOutput1, (Visual *)CopyFromParent0L, |
| 625 | *valueMask, attributes); |
| 626 | |
| 627 | #ifndef OLDXAW1 |
| 628 | if (w->core.background_pixmap > XtUnspecifiedPixmap((Pixmap)2)) { |
| 629 | pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w)((w)->core.screen), |
| 630 | w->core.colormap, w->core.depth); |
| 631 | if (pixmap && pixmap->mask) |
| 632 | XawReshapeWidget(w, pixmap); |
| 633 | } |
| 634 | #endif |
| 635 | } |
| 636 | |
| 637 | |
| 638 | static Boolean |
| 639 | XawBoxSetValues(Widget current, Widget request, Widget cnew, |
| 640 | ArgList args, Cardinal *num_args) |
| 641 | { |
| 642 | |
| 643 | #ifndef OLDXAW1 |
| 644 | BoxWidget b_old = (BoxWidget)current; |
| 645 | BoxWidget b_new = (BoxWidget)cnew; |
| 646 | |
| 647 | if (b_old->core.background_pixmap != b_new->core.background_pixmap) { |
| 648 | XawPixmap *opix, *npix; |
| 649 | |
| 650 | opix = XawPixmapFromXPixmap(b_old->core.background_pixmap, |
| 651 | XtScreen(b_old)((b_old)->core.screen), b_old->core.colormap, |
| 652 | b_old->core.depth); |
| 653 | npix = XawPixmapFromXPixmap(b_new->core.background_pixmap, |
| 654 | XtScreen(b_new)((b_new)->core.screen), b_new->core.colormap, |
| 655 | b_new->core.depth); |
| 656 | if ((npix && npix->mask) || (opix && opix->mask)) |
| 657 | XawReshapeWidget(cnew, npix); |
| 658 | } |
| 659 | #endif /* OLDXAW */ |
| 660 | |
| 661 | return (False0); |
| 662 | } |
| 663 | |
| 664 | #ifndef OLDXAW1 |
| 665 | static void |
| 666 | XawBoxExpose(Widget w, XEvent *event, Region region) |
| 667 | { |
| 668 | BoxWidget xaw = (BoxWidget)w; |
| 669 | |
| 670 | if (xaw->box.display_list) |
| 671 | XawRunDisplayList(w, xaw->box.display_list, event, region); |
| 672 | } |
| 673 | #endif /* OLDXAW */ |