ui/motif/Grid.c

changeset 110
c00e968d018b
parent 102
64ded9f6a6c6
equal deleted inserted replaced
109:c3dfcb8f0be7 110:c00e968d018b
297 }; 297 };
298 298
299 WidgetClass gridClass = (WidgetClass)&gridClassRec; 299 WidgetClass gridClass = (WidgetClass)&gridClassRec;
300 300
301 301
302 void grid_class_initialize(Widget request, Widget new, ArgList args, Cardinal *num_args) { 302 void grid_class_initialize(void) {
303 303
304 } 304 }
305 void grid_initialize(Widget request, Widget new, ArgList args, Cardinal num_args) { 305 void grid_initialize(Widget request, Widget new, ArgList args, Cardinal num_args) {
306 MyWidget mn = (MyWidget)new; 306 Grid mn = (Grid)new;
307 307
308 mn->mywidget.max_col = 0; 308 mn->mywidget.max_col = 0;
309 mn->mywidget.max_row = 0; 309 mn->mywidget.max_row = 0;
310 310
311 } 311 }
312 void grid_realize(MyWidget w,XtValueMask *valueMask,XSetWindowAttributes *attributes) { 312 void grid_realize(Widget w,XtValueMask *valueMask,XSetWindowAttributes *attributes) {
313 XtMakeResizeRequest((Widget)w, 400, 400, NULL, NULL); 313 Grid grid = (Grid)w;
314 XtMakeResizeRequest(w, 400, 400, NULL, NULL);
314 (coreClassRec.core_class.realize)((Widget)w, valueMask, attributes); 315 (coreClassRec.core_class.realize)((Widget)w, valueMask, attributes);
315 grid_place_children(w); 316 grid_place_children(grid);
316 } 317 }
317 318
318 319
319 void grid_destroy(MyWidget widget) { 320 void grid_destroy(Grid widget) {
320 321
321 } 322 }
322 void grid_resize(MyWidget widget) { 323 void grid_resize(Grid widget) {
323 grid_place_children(widget); 324 grid_place_children(widget);
324 } 325 }
325 326
326 void grid_expose(MyWidget widget, XEvent *event, Region region) { 327 void grid_expose(Grid widget, XEvent *event, Region region) {
327 328
328 } 329 }
329 330
330 331
331 Boolean grid_set_values(Widget old, Widget request, Widget neww, ArgList args, Cardinal *num_args) { 332 Boolean grid_set_values(Widget old, Widget request, Widget neww, ArgList args, Cardinal *num_args) {
334 335
335 Boolean grid_acceptfocus(Widget w, Time *t) { 336 Boolean grid_acceptfocus(Widget w, Time *t) {
336 337
337 } 338 }
338 339
339 void grid_getfocus(MyWidget myw, XEvent *event, String *params, Cardinal *nparam) { 340 void grid_getfocus(Widget myw, XEvent *event, String *params, Cardinal *nparam) {
340 341
341 } 342 }
342 343
343 void grid_loosefocus(MyWidget myw, XEvent *event, String *params, Cardinal *nparam) { 344 void grid_loosefocus(Widget myw, XEvent *event, String *params, Cardinal *nparam) {
344 345
345 } 346 }
346 347
347 348
348 349
356 } 357 }
357 if((request->request_mode & CWHeight) == CWHeight) { 358 if((request->request_mode & CWHeight) == CWHeight) {
358 widget->core.height = request->height; 359 widget->core.height = request->height;
359 constraints->grid.pref_height = request->height; 360 constraints->grid.pref_height = request->height;
360 } 361 }
361 grid_place_children((MyWidget)XtParent(widget)); 362 grid_place_children((Grid)XtParent(widget));
362 return XtGeometryYes; 363 return XtGeometryYes;
363 } 364 }
364 365
365 void GridChangeManaged(Widget widget) { 366 void GridChangeManaged(Widget widget) {
366 367
367 } 368 }
368 369
369 Boolean ConstraintSetValues(Widget old, Widget request, Widget neww, ArgList args, Cardinal *num_args) { 370 Boolean ConstraintSetValues(Widget old, Widget request, Widget neww, ArgList args, Cardinal *num_args) {
370 GridConstraintRec *constraints = neww->core.constraints; 371 GridConstraintRec *constraints = neww->core.constraints;
371 MyWidget grid = (MyWidget)XtParent(neww); 372 Grid grid = (Grid)XtParent(neww);
372 if(constraints->grid.x > grid->mywidget.max_col) { 373 if(constraints->grid.x > grid->mywidget.max_col) {
373 grid->mywidget.max_col = constraints->grid.x; 374 grid->mywidget.max_col = constraints->grid.x;
374 } 375 }
375 if(constraints->grid.y > grid->mywidget.max_row) { 376 if(constraints->grid.y > grid->mywidget.max_row) {
376 grid->mywidget.max_row = constraints->grid.y; 377 grid->mywidget.max_row = constraints->grid.y;
385 Cardinal* num_args 386 Cardinal* num_args
386 ) 387 )
387 { 388 {
388 GridConstraintRec *constraints = neww->core.constraints; 389 GridConstraintRec *constraints = neww->core.constraints;
389 390
390 MyWidget grid = (MyWidget)XtParent(neww); 391 Grid grid = (Grid)XtParent(neww);
391 if(constraints->grid.x > grid->mywidget.max_col) { 392 if(constraints->grid.x > grid->mywidget.max_col) {
392 grid->mywidget.max_col = constraints->grid.x; 393 grid->mywidget.max_col = constraints->grid.x;
393 } 394 }
394 if(constraints->grid.y > grid->mywidget.max_row) { 395 if(constraints->grid.y > grid->mywidget.max_row) {
395 grid->mywidget.max_row = constraints->grid.y; 396 grid->mywidget.max_row = constraints->grid.y;
396 } 397 }
397 constraints->grid.pref_width = neww->core.width; 398 constraints->grid.pref_width = neww->core.width;
398 constraints->grid.pref_height = neww->core.height; 399 constraints->grid.pref_height = neww->core.height;
399 } 400 }
400 401
401 void grid_place_children(MyWidget w) { 402 void grid_place_children(Grid w) {
402 int ncols = w->mywidget.max_col+1; 403 int ncols = w->mywidget.max_col+1;
403 int nrows = w->mywidget.max_row+1; 404 int nrows = w->mywidget.max_row+1;
404 GridDef *cols = calloc(ncols, sizeof(GridDef)); 405 GridDef *cols = calloc(ncols, sizeof(GridDef));
405 GridDef *rows = calloc(nrows, sizeof(GridDef)); 406 GridDef *rows = calloc(nrows, sizeof(GridDef));
406 int num_cols_expanding = 0; 407 int num_cols_expanding = 0;

mercurial