]> git.saurik.com Git - wxWidgets.git/blob - src/common/layout.cpp
final sweep over docs - replace & with \&
[wxWidgets.git] / src / common / layout.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: layout.cpp
3 // Purpose: Constraint layout system classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // =============================================================================
13 // declarations
14 // =============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "layout.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include "wx/defs.h"
33 #endif
34
35 #if wxUSE_CONSTRAINTS
36
37 #ifndef WX_PRECOMP
38 #include "wx/window.h"
39 #include "wx/utils.h"
40 #include "wx/dialog.h"
41 #include "wx/msgdlg.h"
42 #include "wx/intl.h"
43 #endif
44
45 #include "wx/layout.h"
46
47 IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject)
48 IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
49
50
51 wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
52 {
53 myEdge = wxTop;
54 relationship = wxUnconstrained;
55 margin = 0;
56 value = 0;
57 percent = 0;
58 otherEdge = wxTop;
59 done = false;
60 otherWin = (wxWindowBase *) NULL;
61 }
62
63 void wxIndividualLayoutConstraint::Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val, int marg)
64 {
65 if (rel == wxSameAs)
66 {
67 // If Set is called by the user with wxSameAs then call SameAs to do
68 // it since it will actually use wxPercent instead.
69 SameAs(otherW, otherE, marg);
70 return;
71 }
72
73 relationship = rel;
74 otherWin = otherW;
75 otherEdge = otherE;
76
77 if ( rel == wxPercentOf )
78 {
79 percent = val;
80 }
81 else
82 {
83 value = val;
84 }
85
86 margin = marg;
87 }
88
89 void wxIndividualLayoutConstraint::LeftOf(wxWindowBase *sibling, int marg)
90 {
91 Set(wxLeftOf, sibling, wxLeft, 0, marg);
92 }
93
94 void wxIndividualLayoutConstraint::RightOf(wxWindowBase *sibling, int marg)
95 {
96 Set(wxRightOf, sibling, wxRight, 0, marg);
97 }
98
99 void wxIndividualLayoutConstraint::Above(wxWindowBase *sibling, int marg)
100 {
101 Set(wxAbove, sibling, wxTop, 0, marg);
102 }
103
104 void wxIndividualLayoutConstraint::Below(wxWindowBase *sibling, int marg)
105 {
106 Set(wxBelow, sibling, wxBottom, 0, marg);
107 }
108
109 //
110 // 'Same edge' alignment
111 //
112 void wxIndividualLayoutConstraint::SameAs(wxWindowBase *otherW, wxEdge edge, int marg)
113 {
114 Set(wxPercentOf, otherW, edge, 100, marg);
115 }
116
117 // The edge is a percentage of the other window's edge
118 void wxIndividualLayoutConstraint::PercentOf(wxWindowBase *otherW, wxEdge wh, int per)
119 {
120 Set(wxPercentOf, otherW, wh, per);
121 }
122
123 //
124 // Edge has absolute value
125 //
126 void wxIndividualLayoutConstraint::Absolute(int val)
127 {
128 value = val;
129 relationship = wxAbsolute;
130 }
131
132 // Reset constraint if it mentions otherWin
133 bool wxIndividualLayoutConstraint::ResetIfWin(wxWindowBase *otherW)
134 {
135 if (otherW == otherWin)
136 {
137 myEdge = wxTop;
138 relationship = wxAsIs;
139 margin = 0;
140 value = 0;
141 percent = 0;
142 otherEdge = wxTop;
143 otherWin = (wxWindowBase *) NULL;
144 return true;
145 }
146
147 return false;
148 }
149
150 // Try to satisfy constraint
151 bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constraints, wxWindowBase *win)
152 {
153 if (relationship == wxAbsolute)
154 {
155 done = true;
156 return true;
157 }
158
159 switch (myEdge)
160 {
161 case wxLeft:
162 {
163 switch (relationship)
164 {
165 case wxLeftOf:
166 {
167 // We can know this edge if: otherWin is win's
168 // parent, or otherWin has a satisfied constraint,
169 // or otherWin has no constraint.
170 int edgePos = GetEdge(otherEdge, win, otherWin);
171 if (edgePos != -1)
172 {
173 value = edgePos - margin;
174 done = true;
175 return true;
176 }
177 else
178 return false;
179 }
180 case wxRightOf:
181 {
182 int edgePos = GetEdge(otherEdge, win, otherWin);
183 if (edgePos != -1)
184 {
185 value = edgePos + margin;
186 done = true;
187 return true;
188 }
189 else
190 return false;
191 }
192 case wxPercentOf:
193 {
194 int edgePos = GetEdge(otherEdge, win, otherWin);
195 if (edgePos != -1)
196 {
197 value = (int)(edgePos*(((float)percent)*0.01) + margin);
198 done = true;
199 return true;
200 }
201 else
202 return false;
203 }
204 case wxUnconstrained:
205 {
206 // We know the left-hand edge position if we know
207 // the right-hand edge and we know the width; OR if
208 // we know the centre and the width.
209 if (constraints->right.GetDone() && constraints->width.GetDone())
210 {
211 value = (constraints->right.GetValue() - constraints->width.GetValue() + margin);
212 done = true;
213 return true;
214 }
215 else if (constraints->centreX.GetDone() && constraints->width.GetDone())
216 {
217 value = (int)(constraints->centreX.GetValue() - (constraints->width.GetValue()/2) + margin);
218 done = true;
219 return true;
220 }
221 else
222 return false;
223 }
224 case wxAsIs:
225 {
226 int y;
227 win->GetPosition(&value, &y);
228 done = true;
229 return true;
230 }
231 default:
232 break;
233 }
234 break;
235 }
236 case wxRight:
237 {
238 switch (relationship)
239 {
240 case wxLeftOf:
241 {
242 // We can know this edge if: otherWin is win's
243 // parent, or otherWin has a satisfied constraint,
244 // or otherWin has no constraint.
245 int edgePos = GetEdge(otherEdge, win, otherWin);
246 if (edgePos != -1)
247 {
248 value = edgePos - margin;
249 done = true;
250 return true;
251 }
252 else
253 return false;
254 }
255 case wxRightOf:
256 {
257 int edgePos = GetEdge(otherEdge, win, otherWin);
258 if (edgePos != -1)
259 {
260 value = edgePos + margin;
261 done = true;
262 return true;
263 }
264 else
265 return false;
266 }
267 case wxPercentOf:
268 {
269 int edgePos = GetEdge(otherEdge, win, otherWin);
270 if (edgePos != -1)
271 {
272 value = (int)(edgePos*(((float)percent)*0.01) - margin);
273 done = true;
274 return true;
275 }
276 else
277 return false;
278 }
279 case wxUnconstrained:
280 {
281 // We know the right-hand edge position if we know the
282 // left-hand edge and we know the width, OR if we know the
283 // centre edge and the width.
284 if (constraints->left.GetDone() && constraints->width.GetDone())
285 {
286 value = (constraints->left.GetValue() + constraints->width.GetValue() - margin);
287 done = true;
288 return true;
289 }
290 else if (constraints->centreX.GetDone() && constraints->width.GetDone())
291 {
292 value = (int)(constraints->centreX.GetValue() + (constraints->width.GetValue()/2) - margin);
293 done = true;
294 return true;
295 }
296 else
297 return false;
298 }
299 case wxAsIs:
300 {
301 int x, y;
302 int w, h;
303 win->GetBestSize(&w, &h);
304 win->GetPosition(&x, &y);
305 value = x + w;
306 done = true;
307 return true;
308 }
309 default:
310 break;
311 }
312 break;
313 }
314 case wxTop:
315 {
316 switch (relationship)
317 {
318 case wxAbove:
319 {
320 // We can know this edge if: otherWin is win's
321 // parent, or otherWin has a satisfied constraint,
322 // or otherWin has no constraint.
323 int edgePos = GetEdge(otherEdge, win, otherWin);
324 if (edgePos != -1)
325 {
326 value = edgePos - margin;
327 done = true;
328 return true;
329 }
330 else
331 return false;
332 }
333 case wxBelow:
334 {
335 int edgePos = GetEdge(otherEdge, win, otherWin);
336 if (edgePos != -1)
337 {
338 value = edgePos + margin;
339 done = true;
340 return true;
341 }
342 else
343 return false;
344 }
345 case wxPercentOf:
346 {
347 int edgePos = GetEdge(otherEdge, win, otherWin);
348 if (edgePos != -1)
349 {
350 value = (int)(edgePos*(((float)percent)*0.01) + margin);
351 done = true;
352 return true;
353 }
354 else
355 return false;
356 }
357 case wxUnconstrained:
358 {
359 // We know the top edge position if we know the bottom edge
360 // and we know the height; OR if we know the centre edge and
361 // the height.
362 if (constraints->bottom.GetDone() && constraints->height.GetDone())
363 {
364 value = (constraints->bottom.GetValue() - constraints->height.GetValue() + margin);
365 done = true;
366 return true;
367 }
368 else if (constraints->centreY.GetDone() && constraints->height.GetDone())
369 {
370 value = (constraints->centreY.GetValue() - (constraints->height.GetValue()/2) + margin);
371 done = true;
372 return true;
373 }
374 else
375 return false;
376 }
377 case wxAsIs:
378 {
379 int x;
380 win->GetPosition(&x, &value);
381 done = true;
382 return true;
383 }
384 default:
385 break;
386 }
387 break;
388 }
389 case wxBottom:
390 {
391 switch (relationship)
392 {
393 case wxAbove:
394 {
395 // We can know this edge if: otherWin is win's parent,
396 // or otherWin has a satisfied constraint, or
397 // otherWin has no constraint.
398 int edgePos = GetEdge(otherEdge, win, otherWin);
399 if (edgePos != -1)
400 {
401 value = edgePos + margin;
402 done = true;
403 return true;
404 }
405 else
406 return false;
407 }
408 case wxBelow:
409 {
410 int edgePos = GetEdge(otherEdge, win, otherWin);
411 if (edgePos != -1)
412 {
413 value = edgePos - margin;
414 done = true;
415 return true;
416 }
417 else
418 return false;
419 }
420 case wxPercentOf:
421 {
422 int edgePos = GetEdge(otherEdge, win, otherWin);
423 if (edgePos != -1)
424 {
425 value = (int)(edgePos*(((float)percent)*0.01) - margin);
426 done = true;
427 return true;
428 }
429 else
430 return false;
431 }
432 case wxUnconstrained:
433 {
434 // We know the bottom edge position if we know the top edge
435 // and we know the height; OR if we know the centre edge and
436 // the height.
437 if (constraints->top.GetDone() && constraints->height.GetDone())
438 {
439 value = (constraints->top.GetValue() + constraints->height.GetValue() - margin);
440 done = true;
441 return true;
442 }
443 else if (constraints->centreY.GetDone() && constraints->height.GetDone())
444 {
445 value = (constraints->centreY.GetValue() + (constraints->height.GetValue()/2) - margin);
446 done = true;
447 return true;
448 }
449 else
450 return false;
451 }
452 case wxAsIs:
453 {
454 int x, y;
455 int w, h;
456 win->GetBestSize(&w, &h);
457 win->GetPosition(&x, &y);
458 value = h + y;
459 done = true;
460 return true;
461 }
462 default:
463 break;
464 }
465 break;
466 }
467 case wxCentreX:
468 {
469 switch (relationship)
470 {
471 case wxLeftOf:
472 {
473 // We can know this edge if: otherWin is win's parent, or
474 // otherWin has a satisfied constraint, or otherWin has no
475 // constraint.
476 int edgePos = GetEdge(otherEdge, win, otherWin);
477 if (edgePos != -1)
478 {
479 value = edgePos - margin;
480 done = true;
481 return true;
482 }
483 else
484 return false;
485 }
486 case wxRightOf:
487 {
488 int edgePos = GetEdge(otherEdge, win, otherWin);
489 if (edgePos != -1)
490 {
491 value = edgePos + margin;
492 done = true;
493 return true;
494 }
495 else
496 return false;
497 }
498 case wxPercentOf:
499 {
500 int edgePos = GetEdge(otherEdge, win, otherWin);
501 if (edgePos != -1)
502 {
503 value = (int)(edgePos*(((float)percent)*0.01) + margin);
504 done = true;
505 return true;
506 }
507 else
508 return false;
509 }
510 case wxUnconstrained:
511 {
512 // We know the centre position if we know
513 // the left-hand edge and we know the width, OR
514 // the right-hand edge and the width
515 if (constraints->left.GetDone() && constraints->width.GetDone())
516 {
517 value = (int)(constraints->left.GetValue() + (constraints->width.GetValue()/2) + margin);
518 done = true;
519 return true;
520 }
521 else if (constraints->right.GetDone() && constraints->width.GetDone())
522 {
523 value = (int)(constraints->left.GetValue() - (constraints->width.GetValue()/2) + margin);
524 done = true;
525 return true;
526 }
527 else
528 return false;
529 }
530 default:
531 break;
532 }
533 break;
534 }
535 case wxCentreY:
536 {
537 switch (relationship)
538 {
539 case wxAbove:
540 {
541 // We can know this edge if: otherWin is win's parent,
542 // or otherWin has a satisfied constraint, or otherWin
543 // has no constraint.
544 int edgePos = GetEdge(otherEdge, win, otherWin);
545 if (edgePos != -1)
546 {
547 value = edgePos - margin;
548 done = true;
549 return true;
550 }
551 else
552 return false;
553 }
554 case wxBelow:
555 {
556 int edgePos = GetEdge(otherEdge, win, otherWin);
557 if (edgePos != -1)
558 {
559 value = edgePos + margin;
560 done = true;
561 return true;
562 }
563 else
564 return false;
565 }
566 case wxPercentOf:
567 {
568 int edgePos = GetEdge(otherEdge, win, otherWin);
569 if (edgePos != -1)
570 {
571 value = (int)(edgePos*(((float)percent)*0.01) + margin);
572 done = true;
573 return true;
574 }
575 else
576 return false;
577 }
578 case wxUnconstrained:
579 {
580 // We know the centre position if we know
581 // the top edge and we know the height, OR
582 // the bottom edge and the height.
583 if (constraints->bottom.GetDone() && constraints->height.GetDone())
584 {
585 value = (int)(constraints->bottom.GetValue() - (constraints->height.GetValue()/2) + margin);
586 done = true;
587 return true;
588 }
589 else if (constraints->top.GetDone() && constraints->height.GetDone())
590 {
591 value = (int)(constraints->top.GetValue() + (constraints->height.GetValue()/2) + margin);
592 done = true;
593 return true;
594 }
595 else
596 return false;
597 }
598 default:
599 break;
600 }
601 break;
602 }
603 case wxWidth:
604 {
605 switch (relationship)
606 {
607 case wxPercentOf:
608 {
609 int edgePos = GetEdge(otherEdge, win, otherWin);
610 if (edgePos != -1)
611 {
612 value = (int)(edgePos*(((float)percent)*0.01));
613 done = true;
614 return true;
615 }
616 else
617 return false;
618 }
619 case wxAsIs:
620 {
621 if (win)
622 {
623 int h;
624 win->GetBestSize(&value, &h);
625 done = true;
626 return true;
627 }
628 else return false;
629 }
630 case wxUnconstrained:
631 {
632 // We know the width if we know the left edge and the right edge, OR
633 // if we know the left edge and the centre, OR
634 // if we know the right edge and the centre
635 if (constraints->left.GetDone() && constraints->right.GetDone())
636 {
637 value = constraints->right.GetValue() - constraints->left.GetValue();
638 done = true;
639 return true;
640 }
641 else if (constraints->centreX.GetDone() && constraints->left.GetDone())
642 {
643 value = (int)(2*(constraints->centreX.GetValue() - constraints->left.GetValue()));
644 done = true;
645 return true;
646 }
647 else if (constraints->centreX.GetDone() && constraints->right.GetDone())
648 {
649 value = (int)(2*(constraints->right.GetValue() - constraints->centreX.GetValue()));
650 done = true;
651 return true;
652 }
653 else
654 return false;
655 }
656 default:
657 break;
658 }
659 break;
660 }
661 case wxHeight:
662 {
663 switch (relationship)
664 {
665 case wxPercentOf:
666 {
667 int edgePos = GetEdge(otherEdge, win, otherWin);
668 if (edgePos != -1)
669 {
670 value = (int)(edgePos*(((float)percent)*0.01));
671 done = true;
672 return true;
673 }
674 else
675 return false;
676 }
677 case wxAsIs:
678 {
679 if (win)
680 {
681 int w;
682 win->GetBestSize(&w, &value);
683 done = true;
684 return true;
685 }
686 else return false;
687 }
688 case wxUnconstrained:
689 {
690 // We know the height if we know the top edge and the bottom edge, OR
691 // if we know the top edge and the centre, OR
692 // if we know the bottom edge and the centre
693 if (constraints->top.GetDone() && constraints->bottom.GetDone())
694 {
695 value = constraints->bottom.GetValue() - constraints->top.GetValue();
696 done = true;
697 return true;
698 }
699 else if (constraints->top.GetDone() && constraints->centreY.GetDone())
700 {
701 value = (int)(2*(constraints->centreY.GetValue() - constraints->top.GetValue()));
702 done = true;
703 return true;
704 }
705 else if (constraints->bottom.GetDone() && constraints->centreY.GetDone())
706 {
707 value = (int)(2*(constraints->bottom.GetValue() - constraints->centreY.GetValue()));
708 done = true;
709 return true;
710 }
711 else
712 return false;
713 }
714 default:
715 break;
716 }
717 break;
718 }
719 default:
720 break;
721 }
722 return false;
723 }
724
725 // Get the value of this edge or dimension, or if this is not determinable, -1.
726 int wxIndividualLayoutConstraint::GetEdge(wxEdge which,
727 wxWindowBase *thisWin,
728 wxWindowBase *other) const
729 {
730 // If the edge or dimension belongs to the parent, then we know the
731 // dimension is obtainable immediately. E.g. a wxExpandSizer may contain a
732 // button (but the button's true parent is a panel, not the sizer)
733 if (other->GetChildren().Find((wxWindow*)thisWin))
734 {
735 switch (which)
736 {
737 case wxLeft:
738 {
739 return 0;
740 }
741 case wxTop:
742 {
743 return 0;
744 }
745 case wxRight:
746 {
747 int w, h;
748 other->GetClientSizeConstraint(&w, &h);
749 return w;
750 }
751 case wxBottom:
752 {
753 int w, h;
754 other->GetClientSizeConstraint(&w, &h);
755 return h;
756 }
757 case wxWidth:
758 {
759 int w, h;
760 other->GetClientSizeConstraint(&w, &h);
761 return w;
762 }
763 case wxHeight:
764 {
765 int w, h;
766 other->GetClientSizeConstraint(&w, &h);
767 return h;
768 }
769 case wxCentreX:
770 case wxCentreY:
771 {
772 int w, h;
773 other->GetClientSizeConstraint(&w, &h);
774 if (which == wxCentreX)
775 return (int)(w/2);
776 else
777 return (int)(h/2);
778 }
779 default:
780 return -1;
781 }
782 }
783 switch (which)
784 {
785 case wxLeft:
786 {
787 wxLayoutConstraints *constr = other->GetConstraints();
788 // If no constraints, it means the window is not dependent
789 // on anything, and therefore we know its value immediately
790 if (constr)
791 {
792 if (constr->left.GetDone())
793 return constr->left.GetValue();
794 else
795 return -1;
796 }
797 else
798 {
799 int x, y;
800 other->GetPosition(&x, &y);
801 return x;
802 }
803 }
804 case wxTop:
805 {
806 wxLayoutConstraints *constr = other->GetConstraints();
807 // If no constraints, it means the window is not dependent
808 // on anything, and therefore we know its value immediately
809 if (constr)
810 {
811 if (constr->top.GetDone())
812 return constr->top.GetValue();
813 else
814 return -1;
815 }
816 else
817 {
818 int x, y;
819 other->GetPosition(&x, &y);
820 return y;
821 }
822 }
823 case wxRight:
824 {
825 wxLayoutConstraints *constr = other->GetConstraints();
826 // If no constraints, it means the window is not dependent
827 // on anything, and therefore we know its value immediately
828 if (constr)
829 {
830 if (constr->right.GetDone())
831 return constr->right.GetValue();
832 else
833 return -1;
834 }
835 else
836 {
837 int x, y, w, h;
838 other->GetPosition(&x, &y);
839 other->GetSize(&w, &h);
840 return (int)(x + w);
841 }
842 }
843 case wxBottom:
844 {
845 wxLayoutConstraints *constr = other->GetConstraints();
846 // If no constraints, it means the window is not dependent
847 // on anything, and therefore we know its value immediately
848 if (constr)
849 {
850 if (constr->bottom.GetDone())
851 return constr->bottom.GetValue();
852 else
853 return -1;
854 }
855 else
856 {
857 int x, y, w, h;
858 other->GetPosition(&x, &y);
859 other->GetSize(&w, &h);
860 return (int)(y + h);
861 }
862 }
863 case wxWidth:
864 {
865 wxLayoutConstraints *constr = other->GetConstraints();
866 // If no constraints, it means the window is not dependent
867 // on anything, and therefore we know its value immediately
868 if (constr)
869 {
870 if (constr->width.GetDone())
871 return constr->width.GetValue();
872 else
873 return -1;
874 }
875 else
876 {
877 int w, h;
878 other->GetSize(&w, &h);
879 return w;
880 }
881 }
882 case wxHeight:
883 {
884 wxLayoutConstraints *constr = other->GetConstraints();
885 // If no constraints, it means the window is not dependent
886 // on anything, and therefore we know its value immediately
887 if (constr)
888 {
889 if (constr->height.GetDone())
890 return constr->height.GetValue();
891 else
892 return -1;
893 }
894 else
895 {
896 int w, h;
897 other->GetSize(&w, &h);
898 return h;
899 }
900 }
901 case wxCentreX:
902 {
903 wxLayoutConstraints *constr = other->GetConstraints();
904 // If no constraints, it means the window is not dependent
905 // on anything, and therefore we know its value immediately
906 if (constr)
907 {
908 if (constr->centreX.GetDone())
909 return constr->centreX.GetValue();
910 else
911 return -1;
912 }
913 else
914 {
915 int x, y, w, h;
916 other->GetPosition(&x, &y);
917 other->GetSize(&w, &h);
918 return (int)(x + (w/2));
919 }
920 }
921 case wxCentreY:
922 {
923 wxLayoutConstraints *constr = other->GetConstraints();
924 // If no constraints, it means the window is not dependent
925 // on anything, and therefore we know its value immediately
926 if (constr)
927 {
928 if (constr->centreY.GetDone())
929 return constr->centreY.GetValue();
930 else
931 return -1;
932 }
933 else
934 {
935 int x, y, w, h;
936 other->GetPosition(&x, &y);
937 other->GetSize(&w, &h);
938 return (int)(y + (h/2));
939 }
940 }
941 default:
942 break;
943 }
944 return -1;
945 }
946
947 wxLayoutConstraints::wxLayoutConstraints()
948 {
949 left.SetEdge(wxLeft);
950 top.SetEdge(wxTop);
951 right.SetEdge(wxRight);
952 bottom.SetEdge(wxBottom);
953 centreX.SetEdge(wxCentreX);
954 centreY.SetEdge(wxCentreY);
955 width.SetEdge(wxWidth);
956 height.SetEdge(wxHeight);
957 }
958
959 bool wxLayoutConstraints::SatisfyConstraints(wxWindowBase *win, int *nChanges)
960 {
961 int noChanges = 0;
962
963 bool done = width.GetDone();
964 bool newDone = (done ? true : width.SatisfyConstraint(this, win));
965 if (newDone != done)
966 noChanges ++;
967
968 done = height.GetDone();
969 newDone = (done ? true : height.SatisfyConstraint(this, win));
970 if (newDone != done)
971 noChanges ++;
972
973 done = left.GetDone();
974 newDone = (done ? true : left.SatisfyConstraint(this, win));
975 if (newDone != done)
976 noChanges ++;
977
978 done = top.GetDone();
979 newDone = (done ? true : top.SatisfyConstraint(this, win));
980 if (newDone != done)
981 noChanges ++;
982
983 done = right.GetDone();
984 newDone = (done ? true : right.SatisfyConstraint(this, win));
985 if (newDone != done)
986 noChanges ++;
987
988 done = bottom.GetDone();
989 newDone = (done ? true : bottom.SatisfyConstraint(this, win));
990 if (newDone != done)
991 noChanges ++;
992
993 done = centreX.GetDone();
994 newDone = (done ? true : centreX.SatisfyConstraint(this, win));
995 if (newDone != done)
996 noChanges ++;
997
998 done = centreY.GetDone();
999 newDone = (done ? true : centreY.SatisfyConstraint(this, win));
1000 if (newDone != done)
1001 noChanges ++;
1002
1003 *nChanges = noChanges;
1004
1005 return AreSatisfied();
1006 }
1007
1008 #endif // wxUSE_CONSTRAINTS