Source

wxPython / src / _sizers.i

Full commit
   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
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
/////////////////////////////////////////////////////////////////////////////
// Name:        _sizers.i
// Purpose:     SWIG interface defs for the Sizers
//
// Author:      Robin Dunn
//
// Created:     18-Sept-1999
// RCS-ID:      $Id: _sizers.i 69706 2011-11-08 17:43:21Z RD $
// Copyright:   (c) 2003 by Total Control Software
// Licence:     wxWindows license
/////////////////////////////////////////////////////////////////////////////

// Not a %module


//---------------------------------------------------------------------------

%{
%}

//---------------------------------------------------------------------------
%newgroup;

DocStr(wxSizerFlags,
"Normally, when you add an item to a sizer via `wx.Sizer.Add`, you have
to specify a lot of flags and parameters which can be unwieldy. This
is where wx.SizerFlags comes in: it allows you to specify all
parameters using the named methods instead. For example, instead of::

    sizer.Add(ctrl, 0, wx.EXPAND | wx.ALL, 10)

you can now write::

    sizer.AddF(ctrl, wx.SizerFlags().Expand().Border(wx.ALL, 10))

This is more readable and also allows you to create wx.SizerFlags
objects which can be reused for several sizer items.::

    flagsExpand = wx.SizerFlags(1)
    flagsExpand.Expand().Border(wx.ALL, 10)
    sizer.AddF(ctrl1, flagsExpand)
    sizer.AddF(ctrl2, flagsExpand)

Note that by specification, all methods of wx.SizerFlags return the
wx.SizerFlags object itself allowing chaining multiple method calls
like in the examples above.", "");

class wxSizerFlags
{
public:
    // construct the flags object initialized with the given proportion (0 by
    // default)
    DocCtorStr(
        wxSizerFlags(int proportion = 0),
        "Constructs the flags object with the specified proportion.", "");
    
    ~wxSizerFlags();

    // This typemap ensures that the returned object is the same
    // Python instance as what was passed in as `self`, instead of
    // creating a new proxy as SWIG would normally do.
    %typemap(out) wxSizerFlags& { $result = $self; Py_INCREF($result); }

    DocDeclStr(
        wxSizerFlags& , Proportion(int proportion),
        "Sets the item's proportion value.", "");

    DocDeclStr(
        wxSizerFlags& , Align(int alignment),
        "Sets the item's alignment", "");
    
    DocDeclStr(
        wxSizerFlags& , Expand(),
        "Sets the wx.EXPAND flag, which will cause the item to be expanded to
fill as much space as it is given by the sizer.", "");
    
    DocDeclStr(
        wxSizerFlags& , Centre(),
        "Same as `Center` for those with an alternate dialect of English.", "");
    
    DocDeclStr(
        wxSizerFlags& , Center(),
        "Sets the centering alignment flags.", "");
    
    DocDeclStr(
        wxSizerFlags& , Left(),
        "Aligns the object to the left, a shortcut for calling
Align(wx.ALIGN_LEFT)", "");
    
    DocDeclStr(
        wxSizerFlags& , Right(),
        "Aligns the object to the right, a shortcut for calling
Align(wx.ALIGN_RIGHT)", "");
    
    DocDeclStr(
        wxSizerFlags& , Top(),
        "Aligns the object to the top of the available space, a shortcut for
calling Align(wx.ALIGN_TOP)", "");
    
    DocDeclStr(
        wxSizerFlags& , Bottom(),
        "Aligns the object to the bottom of the available space, a shortcut for
calling Align(wx.ALIGN_BOTTOM)", "");
    
    DocDeclStr(
        wxSizerFlags& , Shaped(),
        "Sets the wx.SHAPED flag.", "");
    
    DocDeclStr(
        wxSizerFlags& , FixedMinSize(),
        "Sets the wx.FIXED_MINSIZE flag.", "");
    
    DocDeclStr(
        wxSizerFlags& , ReserveSpaceEvenIfHidden(),
        "Makes the item ignore window's visibility status", "");
    
    
    %extend {
        DocDeclStr(
            wxSizerFlags& , Border(int direction=wxALL, int borderInPixels=-1),
            "Sets the border of the item in the direction(s) or sides given by the
direction parameter.  If the borderInPixels value is not given then
the default border size (see `GetDefaultBorder`) will be used.", "")
        {
            if (borderInPixels == -1)
                return self->Border(direction);
            else
                return self->Border(direction, borderInPixels);
        }
    }

    DocDeclStr(
        wxSizerFlags& , DoubleBorder(int direction = wxALL),
        "Sets the border in the given direction to twice the default border
size.", "");
    
    DocDeclStr(
        wxSizerFlags& , TripleBorder(int direction = wxALL),
        "Sets the border in the given direction to three times the default
border size.", "");
    
    DocDeclStr(
        wxSizerFlags& , HorzBorder(),
        "Sets the left and right borders to the default border size.", "");
    
    DocDeclStr(
        wxSizerFlags& , DoubleHorzBorder(),
        "Sets the left and right borders to twice the default border size.", "");
    

    // Clear the typemap
    %typemap(out) wxSizerFlags& ;
    

    
    DocDeclStr(
        static int , GetDefaultBorder(),
        "Returns the default border size used by the other border methods", "");
    

    DocDeclStr(
        int , GetProportion() const,
        "Returns the proportion value to be used in the sizer item.", "");
    
    DocDeclStr(
        int , GetFlags() const,
        "Returns the flags value to be used in the sizer item.", "");
    
    DocDeclStr(
        int , GetBorderInPixels() const,
        "Returns the border value in pixels to be used in the sizer item.", "");
};

//---------------------------------------------------------------------------
%newgroup

wxLIST_WRAPPER( wxSizerItemList, wxSizerItem );



DocStr(wxSizerItem,
"The wx.SizerItem class is used to track the position, size and other
attributes of each item managed by a `wx.Sizer`. It is not usually
necessary to use this class because the sizer elements can also be
identified by their positions or window or sizer references but
sometimes it may be more convenient to use wx.SizerItem directly.
Also, custom classes derived from `wx.PySizer` will probably need to
use the collection of wx.SizerItems held by wx.Sizer when calculating
layout.

:see: `wx.Sizer`, `wx.GBSizerItem`", "");

class wxSizerItem : public wxObject {
public:
    DocCtorStr(
        wxSizerItem(),
        "Constructs an empty wx.SizerItem.  Either a window, sizer or spacer
size will need to be set before this item can be used in a Sizer.

You will probably never need to create a wx.SizerItem directly as they
are created automatically when the sizer's Add, Insert or Prepend
methods are called.

:see: `wx.SizerItemSpacer`, `wx.SizerItemWindow`, `wx.SizerItemSizer`", "");

    
    ~wxSizerItem();


    %extend {
        DocStr(
            wxSizerItem( wxWindow *window, int proportion, int flag,
                         int border, PyObject* userData=NULL ),
            "Constructs a `wx.SizerItem` for tracking a window.", "");

        %RenameCtor(SizerItemWindow, wxSizerItem( wxWindow *window, int proportion, int flag,
                                                  int border, PyObject* userData=NULL ))
        {
            wxPyUserData* data = NULL;
            if ( userData ) {
                wxPyBlock_t blocked = wxPyBeginBlockThreads();
                data = new wxPyUserData(userData);
                wxPyEndBlockThreads(blocked);
            }
            return new wxSizerItem(window, proportion, flag, border, data);
        }


        DocStr(
            wxSizerItem( int width, int height, int proportion, int flag,
                         int border, PyObject* userData=NULL),
            "Constructs a `wx.SizerItem` for tracking a spacer.", "");

        %RenameCtor(SizerItemSpacer,  wxSizerItem( int width, int height, int proportion, int flag,
                                                   int border, PyObject* userData=NULL))
        {
            wxPyUserData* data = NULL;
            if ( userData ) {
                wxPyBlock_t blocked = wxPyBeginBlockThreads();
                data = new wxPyUserData(userData);
                wxPyEndBlockThreads(blocked);
            }
            return new wxSizerItem(width, height, proportion, flag, border, data);
        }

        DocStr(
            wxSizerItem( wxSizer *sizer, int proportion, int flag,
                         int border, PyObject* userData=NULL ),
            "Constructs a `wx.SizerItem` for tracking a subsizer", "");

        %disownarg( wxSizer *sizer );
        %RenameCtor(SizerItemSizer,  wxSizerItem( wxSizer *sizer, int proportion, int flag,
                                                  int border, PyObject* userData=NULL ))
        {
            wxPyUserData* data = NULL;
            if ( userData ) {
                wxPyBlock_t blocked = wxPyBeginBlockThreads();
                data = new wxPyUserData(userData);
                wxPyEndBlockThreads(blocked);
            }
            return new wxSizerItem(sizer, proportion, flag, border, data);
        }
        %cleardisown( wxSizer *sizer );
    }



    DocDeclStr(
        void , DeleteWindows(),
        "Destroy the window or the windows in a subsizer, depending on the type
of item.", "");

    DocDeclStr(
        void , DetachSizer(),
        "Enable deleting the SizerItem without destroying the contained sizer.", "");


    DocDeclStr(
        wxSize , GetSize(),
        "Get the current size of the item, as set in the last Layout.", "");

    DocDeclStr(
        wxSize , CalcMin(),
        "Calculates the minimum desired size for the item, including any space
needed by borders.", "");

    DocDeclStr(
        void , SetDimension( const wxPoint& pos, const wxSize& size ),
        "Set the position and size of the space allocated for this item by the
sizer, and adjust the position and size of the item (window or
subsizer) to be within that space taking alignment and borders into
account.", "");


    DocDeclStr(
        wxSize , GetMinSize(),
        "Get the minimum size needed for the item.", "");

    DocDeclStr(
        void , SetMinSize(const wxSize& size),
        "Set the min size needed for the item", "");

    
    DocDeclStr(
        wxSize , GetMinSizeWithBorder() const,
        "Get the minimum size needed for the item with space for the borders
added, if needed.", "");

    DocDeclStr(
        void , SetInitSize( int x, int y ),
        "", "");


    DocStr(SetRatio,
           "Set the ratio item attribute.", "");
    %Rename(SetRatioWH, void, SetRatio( int width, int height ));
    %Rename(SetRatioSize, void, SetRatio( const wxSize& size ));
    void SetRatio( float ratio );

    DocDeclStr(
        float , GetRatio(),
        "Set the ratio item attribute.", "");

    DocDeclStr(
        wxRect , GetRect(),
        "Returns the rectangle that the sizer item should occupy", "");

    void SetId(int id);
    int GetId() const;

    DocDeclStr(
        bool , IsWindow(),
        "Is this sizer item a window?", "");

    DocDeclStr(
        bool , IsSizer(),
        "Is this sizer item a subsizer?", "");

    DocDeclStr(
        bool , IsSpacer(),
        "Is this sizer item a spacer?", "");


    DocDeclStr(
        void , SetProportion( int proportion ),
        "Set the proportion value for this item.", "");

    DocDeclStr(
        int , GetProportion(),
        "Get the proportion value for this item.", "");

    %pythoncode { SetOption = wx.deprecated(SetProportion, "Please use `SetProportion` instead.") }
    %pythoncode { GetOption = wx.deprecated(GetProportion, "Please use `GetProportion` instead.") }


    DocDeclStr(
        void , SetFlag( int flag ),
        "Set the flag value for this item.", "");

    DocDeclStr(
        int , GetFlag(),
        "Get the flag value for this item.", "");


    DocDeclStr(
        void , SetBorder( int border ),
        "Set the border value for this item.", "");

    DocDeclStr(
        int , GetBorder(),
        "Get the border value for this item.", "");



    DocDeclStr(
        wxWindow *, GetWindow(),
        "Get the window (if any) that is managed by this sizer item.", "");


    DocDeclStr(
        wxSizer *, GetSizer(),
        "Get the subsizer (if any) that is managed by this sizer item.", "");

    DocDeclStr(
        wxSize , GetSpacer(),
        "Get the size of the spacer managed by this sizer item.", "");



    
    DocDeclStr(
        void , SetWindow( wxWindow *window ),
        "Set the window to be managed by this sizer item.", "");

    %disownarg( wxSizer *sizer );
    DocDeclStr(
        void , SetSizer( wxSizer *sizer ),
        "Set the subsizer to be managed by this sizer item.", "");
    %cleardisown( wxSizer *sizer );

    DocDeclStr(
        void , SetSpacer( const wxSize &size ),
        "Set the size of the spacer to be managed by this sizer item.", "");

    %pythoncode {
        SetWindow = wx.deprecated(SetWindow, "Use `AssignWindow` instead.")
        SetSizer = wx.deprecated(SetSizer,   "Use `AssignSizer` instead.")
        SetSpacer = wx.deprecated(SetSpacer, "Use `AssignSpacer` instead.")
    }


    
    DocDeclStr(
        void , AssignWindow(wxWindow *window),
        "Set the window to be managed by this sizer item.", "");
    
    DocDeclStr(
        void , AssignSizer(wxSizer *sizer),
        "Set the subsizer to be managed by this sizer item.", "");
    
    DocDeclStr(
        void , AssignSpacer(const wxSize& size),
        "Set the size of the spacer to be managed by this sizer item.", "");
    

    

    DocDeclStr(
        void , Show( bool show ),
        "Set the show item attribute, which sizers use to determine if the item
is to be made part of the layout or not. If the item is tracking a
window then it is shown or hidden as needed.", "");

    DocDeclStr(
        bool , IsShown(),
        "Is the item to be shown in the layout?", "");


    DocDeclStr(
        wxPoint , GetPosition(),
        "Returns the current position of the item, as set in the last Layout.", "");

    DocDeclStr(
        bool , InformFirstDirection( int direction, int size, int availableOtherDir=-1 ),
        "Called once the first component of an item has been decided. This is
used in algorithms that depend on knowing the size in one direction
before the min size in the other direction can be known.  Returns true
if it made use of the information (and min size was changed).", "");
    

    // wxObject* GetUserData();
    %extend {
        // Assume that the user data is a wxPyUserData object and return the contents

        DocStr(GetUserData,
               "Returns the userData associated with this sizer item, or None if there
isn't any.", "");
        PyObject* GetUserData() {
            wxPyUserData* data = (wxPyUserData*)self->GetUserData();
            if (data) {
                Py_INCREF(data->m_obj);
                return data->m_obj;
            } else {
                Py_INCREF(Py_None);
                return Py_None;
            }
        }

        DocStr(SetUserData,
               "Associate a Python object with this sizer item.", "");
        void SetUserData(PyObject* userData) {
            wxPyUserData* data = NULL;
            if ( userData ) {
                wxPyBlock_t blocked = wxPyBeginBlockThreads();
                data = new wxPyUserData(userData);
                wxPyEndBlockThreads(blocked);
            }
            self->SetUserData(data);
        }
    }

    %property(Border, GetBorder, SetBorder, doc="See `GetBorder` and `SetBorder`");
    %property(Flag, GetFlag, SetFlag, doc="See `GetFlag` and `SetFlag`");
    %property(MinSize, GetMinSize, doc="See `GetMinSize`");
    %property(MinSizeWithBorder, GetMinSizeWithBorder, doc="See `GetMinSizeWithBorder`");
    %property(Position, GetPosition, doc="See `GetPosition`");
    %property(Proportion, GetProportion, SetProportion, doc="See `GetProportion` and `SetProportion`");
    %property(Ratio, GetRatio, SetRatio, doc="See `GetRatio` and `SetRatio`");
    %property(Rect, GetRect, doc="See `GetRect`");
    %property(Size, GetSize, doc="See `GetSize`");
    %property(Sizer, GetSizer, AssignSizer, doc="See `GetSizer` and `AssignSizer`");
    %property(Spacer, GetSpacer, AssignSpacer, doc="See `GetSpacer` and `AssignSpacer`");
    %property(UserData, GetUserData, SetUserData, doc="See `GetUserData` and `SetUserData`");
    %property(Window, GetWindow, AssignWindow, doc="See `GetWindow` and `AssignWindow`");
    %property(Id, GetId, SetId);
};


//---------------------------------------------------------------------------

%{
// Figure out the type of the sizer item

struct wxPySizerItemInfo {
    wxPySizerItemInfo()
        : window(NULL), sizer(NULL), gotSize(false),
          size(wxDefaultSize), gotPos(false), pos(-1)
    {}

    wxWindow* window;
    wxSizer*  sizer;
    bool      gotSize;
    wxSize    size;
    bool      gotPos;
    int       pos;
};

static wxPySizerItemInfo wxPySizerItemTypeHelper(PyObject* item, bool checkSize, bool checkIdx ) {

    wxPySizerItemInfo info;
    wxSize  size;
    wxSize* sizePtr = &size;

    // Find out what the type of the item is
    // try wxWindow
    if ( ! wxPyConvertSwigPtr(item, (void**)&info.window, wxT("wxWindow")) ) {
        PyErr_Clear();
        info.window = NULL;

        // try wxSizer
        if ( ! wxPyConvertSwigPtr(item, (void**)&info.sizer, wxT("wxSizer")) ) {
            PyErr_Clear();
            info.sizer = NULL;

            // try wxSize or (w,h)
            if ( checkSize && wxSize_helper(item, &sizePtr)) {
                info.size = *sizePtr;
                info.gotSize = true;
            }

            // or a single int
            if (checkIdx && PyInt_Check(item)) {
                info.pos = PyInt_AsLong(item);
                info.gotPos = true;
            }
        }
    }

    if ( !(info.window || info.sizer || (checkSize && info.gotSize) || (checkIdx && info.gotPos)) ) {
        // no expected type, figure out what kind of error message to generate
        if ( !checkSize && !checkIdx )
            PyErr_SetString(PyExc_TypeError, "wx.Window or wx.Sizer expected for item");
        else if ( checkSize && !checkIdx )
            PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer, wx.Size, or (w,h) expected for item");
        else if ( !checkSize && checkIdx)
            PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer or int (position) expected for item");
        else
            // can this one happen?
            PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer, wx.Size, or (w,h) or int (position) expected for item");
    }

    return info;
}
%}




DocStr(wxSizer,
"wx.Sizer is the abstract base class used for laying out subwindows in
a window.  You cannot use wx.Sizer directly; instead, you will have to
use one of the sizer classes derived from it such as `wx.BoxSizer`,
`wx.StaticBoxSizer`, `wx.GridSizer`, `wx.FlexGridSizer` and
`wx.GridBagSizer`.

The concept implemented by sizers in wxWidgets is closely related to
layout tools in other GUI toolkits, such as Java's AWT, the GTK
toolkit or the Qt toolkit. It is based upon the idea of the individual
subwindows reporting their minimal required size and their ability to
get stretched if the size of the parent window has changed. This will
most often mean that the programmer does not set the original size of
a dialog in the beginning, rather the dialog will assigned a sizer and
this sizer will be queried about the recommended size. The sizer in
turn will query its children, which can be normal windows or contorls,
empty space or other sizers, so that a hierarchy of sizers can be
constructed. Note that wxSizer does not derive from wxWindow and thus
do not interfere with tab ordering and requires very little resources
compared to a real window on screen.

What makes sizers so well fitted for use in wxWidgets is the fact that
every control reports its own minimal size and the algorithm can
handle differences in font sizes or different window (dialog item)
sizes on different platforms without problems. If for example the
standard font as well as the overall design of Mac widgets requires
more space than on Windows, then the initial size of a dialog using a
sizer will automatically be bigger on Mac than on Windows.", "

Sizers may also be used to control the layout of custom drawn items on
the window.  The `Add`, `Insert`, and `Prepend` functions return a
pointer to the newly added `wx.SizerItem`. Just add empty space of the
desired size and attributes, and then use the `wx.SizerItem.GetRect`
method to determine where the drawing operations should take place.

:note: If you wish to create a custom sizer class in wxPython you
    should derive the class from `wx.PySizer` in order to get
    Python-aware capabilities for the various virtual methods.

:see: `wx.SizerItem`

:todo: More dscriptive text here along with some pictures...

");

class wxSizer : public wxObject {
public:
    // wxSizer();      ****  abstract, can't instantiate

    ~wxSizer();

    %extend {
        void _setOORInfo(PyObject* _self) {
            if (!self->GetClientObject())
                self->SetClientObject(new wxPyOORClientData(_self));
        }

        DocAStr(Add,
                "Add(self, item, int proportion=0, int flag=0, int border=0,
    PyObject userData=None) -> wx.SizerItem",

                "Appends a child item to the sizer.", "

    :param item:  The item can be one of three kinds of objects:

        - **window**: A `wx.Window` to be managed by the sizer. Its
          minimal size (either set explicitly by the user or
          calculated internally when constructed with wx.DefaultSize)
          is interpreted as the minimal size to use when laying out
          item in the sizer.  This is particularly useful in
          connection with `wx.Window.SetSizeHints`.

        - **sizer**: The (child-)sizer to be added to the sizer. This
          allows placing a child sizer in a sizer and thus to create
          hierarchies of sizers (for example a vertical box as the top
          sizer and several horizontal boxes on the level beneath).

        - **size**: A `wx.Size` or a 2-element sequence of integers
          that represents the width and height of a spacer to be added
          to the sizer. Adding spacers to sizers gives more
          flexibility in the design of dialogs; imagine for example a
          horizontal box with two buttons at the bottom of a dialog:
          you might want to insert a space between the two buttons and
          make that space stretchable using the *proportion* value and
          the result will be that the left button will be aligned with
          the left side of the dialog and the right button with the
          right side - the space in between will shrink and grow with
          the dialog.

    :param proportion: Although the meaning of this parameter is
        undefined in wx.Sizer, it is used in `wx.BoxSizer` to indicate
        if a child of a sizer can change its size in the main
        orientation of the wx.BoxSizer - where 0 stands for not
        changeable and a value of more than zero is interpreted
        relative (a proportion of the total) to the value of other
        children of the same wx.BoxSizer. For example, you might have
        a horizontal wx.BoxSizer with three children, two of which are
        supposed to change their size with the sizer. Then the two
        stretchable windows should each be given *proportion* value of
        1 to make them grow and shrink equally with the sizer's
        horizontal dimension.  But if one of them had a *proportion*
        value of 2 then it would get a double share of the space
        available after the fixed size items are positioned.

    :param flag: This parameter can be used to set a number of flags
        which can be combined using the binary OR operator ``|``. Two
        main behaviours are defined using these flags. One is the
        border around a window: the *border* parameter determines the
        border width whereas the flags given here determine which
        side(s) of the item that the border will be added. The other
        flags determine how the sizer item behaves when the space
        allotted to the sizer changes, and is somewhat dependent on
        the specific kind of sizer used.

        +----------------------------+------------------------------------------+
        |- wx.TOP                    |These flags are used to specify           |
        |- wx.BOTTOM                 |which side(s) of the sizer item that      |
        |- wx.LEFT                   |the *border* width will apply to.         |
        |- wx.RIGHT                  |                                          |
        |- wx.ALL                    |                                          |
        |                            |                                          |
        +----------------------------+------------------------------------------+
        |- wx.EXPAND                 |The item will be expanded to fill         |
        |                            |the space allotted to the item.           |
        +----------------------------+------------------------------------------+
        |- wx.SHAPED                 |The item will be expanded as much as      |
        |                            |possible while also maintaining its       |
        |                            |aspect ratio                              |
        +----------------------------+------------------------------------------+
        |- wx.FIXED_MINSIZE          |Normally wx.Sizers will use               |
        |                            |`wx.Window.GetMinSize` or                 |
        |                            |`wx.Window.GetBestSize` to determine what |
        |                            |the minimal size of window items should   |
        |                            |be, and will use that size to calculate   |
        |                            |the layout. This allows layouts to adjust |
        |                            |when an item changes and it's best size   |
        |                            |becomes different. If you would rather    |
        |                            |have a window item stay the size it       |
        |                            |started with then use wx.FIXED_MINSIZE.   |
        +----------------------------+------------------------------------------+
        |- wx.ALIGN_CENTER           |The wx.ALIGN flags allow you to specify   |
        |- wx.ALIGN_LEFT             |the alignment of the item within the space|
        |- wx.ALIGN_RIGHT            |allotted to it by the sizer, ajusted for  |
        |- wx.ALIGN_TOP              |the border if any.                        |
        |- wx.ALIGN_BOTTOM           |                                          |
        |- wx.ALIGN_CENTER_VERTICAL  |                                          |
        |- wx.ALIGN_CENTER_HORIZONTAL|                                          |
        +----------------------------+------------------------------------------+


    :param border: Determines the border width, if the *flag*
        parameter is set to include any border flag.

    :param userData: Allows an extra object to be attached to the
        sizer item, for use in derived classes when sizing information
        is more complex than the *proportion* and *flag* will allow for.
");

        wxSizerItem*  Add(PyObject* item, int proportion=0, int flag=0, int border=0,
                          PyObject* userData=NULL) {

            wxPyUserData* data = NULL;
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
            if ( userData && (info.window || info.sizer || info.gotSize) )
                data = new wxPyUserData(userData);
            if ( info.sizer )
                PyObject_SetAttrString(item,"thisown",Py_False);
            wxPyEndBlockThreads(blocked);

            // Now call the real Add method if a valid item type was found
            if ( info.window )
                return self->Add(info.window, proportion, flag, border, data);
            else if ( info.sizer )
                return self->Add(info.sizer, proportion, flag, border, data);
            else if (info.gotSize)
                return self->Add(info.size.GetWidth(), info.size.GetHeight(),
                                 proportion, flag, border, data);
            else
                return NULL;
        }


        DocAStr(AddF,
                "AddF(self, item, wx.SizerFlags flags) -> wx.SizerItem",
                "Similar to `Add` but uses the `wx.SizerFlags` convenience class for
setting the various flags, options and borders.", "");
        wxSizerItem* AddF(PyObject* item, wxSizerFlags& flags) {
            
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
            if ( info.sizer )
                PyObject_SetAttrString(item,"thisown",Py_False);
            wxPyEndBlockThreads(blocked);

            // Now call the real Add method if a valid item type was found
            if ( info.window )
                return self->Add(info.window, flags);
            else if ( info.sizer )
                return self->Add(info.sizer, flags);
            else if (info.gotSize)
                return self->Add(info.size.GetWidth(), info.size.GetHeight(),
                                 flags.GetProportion(),
                                 flags.GetFlags(),
                                 flags.GetBorderInPixels());
            else
                return NULL;
        }

        

        DocAStr(Insert,
                "Insert(self, int before, item, int proportion=0, int flag=0, int border=0,
    PyObject userData=None) -> wx.SizerItem",

                "Inserts a new item into the list of items managed by this sizer before
the item at index *before*.  See `Add` for a description of the parameters.", "");
        wxSizerItem* Insert(int before, PyObject* item, int proportion=0, int flag=0,
                            int border=0, PyObject* userData=NULL) {

            wxPyUserData* data = NULL;
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
            if ( userData && (info.window || info.sizer || info.gotSize) )
                data = new wxPyUserData(userData);
            if ( info.sizer )
                PyObject_SetAttrString(item,"thisown",Py_False);
            wxPyEndBlockThreads(blocked);

            // Now call the real Insert method if a valid item type was found
            if ( info.window )
                return self->Insert(before, info.window, proportion, flag, border, data);
            else if ( info.sizer )
                return self->Insert(before, info.sizer, proportion, flag, border, data);
            else if (info.gotSize)
                return self->Insert(before, info.size.GetWidth(), info.size.GetHeight(),
                                    proportion, flag, border, data);
            else
                return NULL;
        }


        
        DocAStr(InsertF,
                "InsertF(self, int before, item, wx.SizerFlags flags) -> wx.SizerItem",
                "Similar to `Insert`, but uses the `wx.SizerFlags` convenience class
for setting the various flags, options and borders.", "");
        wxSizerItem* InsertF(int before, PyObject* item, wxSizerFlags& flags) {

            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
            if ( info.sizer )
                PyObject_SetAttrString(item,"thisown",Py_False);
            wxPyEndBlockThreads(blocked);

            // Now call the real Insert method if a valid item type was found
            if ( info.window )
                return self->Insert(before, info.window, flags);
            else if ( info.sizer )
                return self->Insert(before, info.sizer, flags);
            else if (info.gotSize)
                return self->Insert(before, info.size.GetWidth(), info.size.GetHeight(),
                                    flags.GetProportion(),
                                    flags.GetFlags(),
                                    flags.GetBorderInPixels());
            else
                return NULL;
        }


        

        DocAStr(Prepend,
                "Prepend(self, item, int proportion=0, int flag=0, int border=0,
    PyObject userData=None) -> wx.SizerItem",

               "Adds a new item to the begining of the list of sizer items managed by
this sizer.  See `Add` for a description of the parameters.", "");
        wxSizerItem* Prepend(PyObject* item, int proportion=0, int flag=0, int border=0,
                             PyObject* userData=NULL) {

            wxPyUserData* data = NULL;
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
            if ( userData && (info.window || info.sizer || info.gotSize) )
                data = new wxPyUserData(userData);
            if ( info.sizer )
                PyObject_SetAttrString(item,"thisown",Py_False);
            wxPyEndBlockThreads(blocked);

            // Now call the real Prepend method if a valid item type was found
            if ( info.window )
                return self->Prepend(info.window, proportion, flag, border, data);
            else if ( info.sizer )
                return self->Prepend(info.sizer, proportion, flag, border, data);
            else if (info.gotSize)
                return self->Prepend(info.size.GetWidth(), info.size.GetHeight(),
                                     proportion, flag, border, data);
            else
                return NULL;
        }


        
        DocAStr(PrependF,
                "PrependF(self, item, wx.SizerFlags flags) -> wx.SizerItem",
                "Similar to `Prepend` but uses the `wx.SizerFlags` convenience class
for setting the various flags, options and borders.", "");
        wxSizerItem* PrependF(PyObject* item, wxSizerFlags& flags) {
            
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
            if ( info.sizer )
                PyObject_SetAttrString(item,"thisown",Py_False);
            wxPyEndBlockThreads(blocked);

            // Now call the real Add method if a valid item type was found
            if ( info.window )
                return self->Prepend(info.window, flags);
            else if ( info.sizer )
                return self->Prepend(info.sizer, flags);
            else if (info.gotSize)
                return self->Prepend(info.size.GetWidth(), info.size.GetHeight(),
                                     flags.GetProportion(),
                                     flags.GetFlags(),
                                     flags.GetBorderInPixels());
            else
                return NULL;
        }



        DocAStr(Remove,
                "Remove(self, item) -> bool",
                "Removes an item from the sizer and destroys it.  This method does not
cause any layout or resizing to take place, call `Layout` to update
the layout on screen after removing a child from the sizer.  The
*item* parameter can be either a window, a sizer, or the zero-based
index of an item to remove.  Returns True if the child item was found
and removed.", "

:note: For historical reasons calling this method with a `wx.Window`
    parameter is deprecated, as it will not be able to destroy the
    window since it is owned by its parent.  You should use `Detach`
    instead.
");
        bool Remove(PyObject* item) {
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
            wxPyEndBlockThreads(blocked);
            if ( info.window )
                return false; //self->Remove(info.window);
            else if ( info.sizer )
                return self->Remove(info.sizer);
            else if ( info.gotPos )
                return self->Remove(info.pos);
            else
                return false;
        }


        DocAStr(Detach,
                "Detach(self, item) -> bool",
                "Detaches an item from the sizer without destroying it.  This method
does not cause any layout or resizing to take place, call `Layout` to
do so.  The *item* parameter can be either a window, a sizer, or the
zero-based index of the item to be detached.  Returns True if the child item
was found and detached.", "");
        bool Detach(PyObject* item) {
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
            wxPyEndBlockThreads(blocked);
            if ( info.window )
                return self->Detach(info.window);
            else if ( info.sizer )
                return self->Detach(info.sizer);
            else if ( info.gotPos )
                return self->Detach(info.pos);
            else
                return false;
        }


        DocAStr(GetItem,
                "GetItem(self, item, recursive=False) -> wx.SizerItem",
                "Returns the `wx.SizerItem` which holds the *item* given.  The *item*
parameter can be either a window, a sizer, or the zero-based index of
the item to be found.", "");
        wxSizerItem* GetItem(PyObject* item, bool recursive=false) {
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
            wxPyEndBlockThreads(blocked);
            if ( info.window )
                return self->GetItem(info.window, recursive);
            else if ( info.sizer )
                return self->GetItem(info.sizer, recursive);
            else if ( info.gotPos )
                return self->GetItem(info.pos);
            else
                return NULL;
        }

        void _SetItemMinSize(PyObject* item, const wxSize& size) {
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
            wxPyEndBlockThreads(blocked);
            if ( info.window )
                self->SetItemMinSize(info.window, size);
            else if ( info.sizer )
                self->SetItemMinSize(info.sizer, size);
            else if ( info.gotPos )
                self->SetItemMinSize(info.pos, size);
        }
    }  // end of the %extend

    %pythoncode {
        def GetItemIndex(self, item):
            """
            Returns the index of the given *item* within the sizer. Does not
            search recursively.  The *item* parameter can be either a window
            or a sizer.  An assertion is raised if the item is not found in
            the sizer.
            """
            sItem = self.GetItem(item)
            assert sItem is not None, "Item not found in the sizer."
            allItems = self.Children
            idx = 0
            for i in allItems:
                if i.this == sItem.this:
                    break
                idx += 1
            return idx
    }

    wxSizerItem* GetItemById( int id, bool recursive = false );
    
    %Rename(_ReplaceWin,
            bool, Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ));
    %Rename(_ReplaceSizer,
            bool, Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ));
    %Rename(_ReplaceItem,
            bool, Replace( size_t index, wxSizerItem *newitem ));
    %pythoncode {
        def Replace(self, olditem, item, recursive=False):
            """
            Detaches the given ``olditem`` from the sizer and replaces it with
            ``item`` which can be a window, sizer, or `wx.SizerItem`.  The
            detached child is destroyed only if it is not a window, (because
            windows are owned by their parent, not the sizer.)  The
            ``recursive`` parameter can be used to search for the given
            element recursivly in subsizers.

            This method does not cause any layout or resizing to take place,
            call `Layout` to do so.

            Returns ``True`` if the child item was found and removed.
            """
            if isinstance(olditem, wx.Window):
                return self._ReplaceWin(olditem, item, recursive)
            elif isinstance(olditem, wx.Sizer):
                return self._ReplaceSizer(olditem, item, recursive)
            elif isinstance(olditem, int):
                return self._ReplaceItem(olditem, item)
            else:
                raise TypeError("Expected Window, Sizer, or integer for first parameter.")
    }
    
    
    DocDeclStr(
        void , SetContainingWindow(wxWindow *window),
        "Set (or unset) the window this sizer is used in.", "");
    
    DocDeclStr(
        wxWindow *, GetContainingWindow() const,
        "Get the window this sizer is used in.", "");
        

    %pythoncode {
    def SetItemMinSize(self, item, *args):
        """
        SetItemMinSize(self, item, Size size)

        Sets the minimum size that will be allocated for an item in the sizer.
        The *item* parameter can be either a window, a sizer, or the
        zero-based index of the item.  If a window or sizer is given then it
        will be searched for recursivly in subsizers if neccessary.
        """
        if len(args) == 2:
            %# for backward compatibility accept separate width,height args too
            return self._SetItemMinSize(item, args)
        else:
            return self._SetItemMinSize(item, args[0])
    }


    %disownarg( wxSizerItem *item ); 

    DocDeclAStrName(
        wxSizerItem* , Add( wxSizerItem *item ),
        "AddItem(self, SizerItem item)",
        "Adds a `wx.SizerItem` to the sizer.", "",
        AddItem);

    DocDeclAStrName(
        wxSizerItem* , Insert( size_t index, wxSizerItem *item ),
        "InsertItem(self, int index, SizerItem item)",
        "Inserts a `wx.SizerItem` to the sizer at the position given by *index*.", "",
        InsertItem);

    DocDeclAStrName(
        wxSizerItem* , Prepend( wxSizerItem *item ),
        "PrependItem(self, SizerItem item)",
        "Prepends a `wx.SizerItem` to the sizer.", "",
        PrependItem);

    %cleardisown( wxSizerItem *item );


    %pythoncode {
    def AddMany(self, items):
        """
        AddMany is a convenience method for adding several items
        to a sizer at one time.  Simply pass it a list of tuples,
        where each tuple consists of the parameters that you
        would normally pass to the `Add` method.
        """
        for item in items:
            if type(item) != type(()) or (len(item) == 2 and type(item[0]) == type(1)):
                item = (item, )
            self.Add(*item)

    def AddSpacer(self, *args, **kw):
        """AddSpacer(int size) --> SizerItem

        Add a spacer that is (size,size) pixels.
        """
        if args and type(args[0]) == int:
            return self.Add( (args[0],args[0] ), 0)
        else: %# otherwise stay compatible with old AddSpacer
            return self.Add(*args, **kw)
    def PrependSpacer(self, *args, **kw):
        """PrependSpacer(int size) --> SizerItem

        Prepend a spacer that is (size, size) pixels."""
        if args and type(args[0]) == int:
            return self.Prepend( (args[0],args[0] ), 0)
        else: %# otherwise stay compatible with old PrependSpacer
            return self.Prepend(*args, **kw)
    def InsertSpacer(self, index, *args, **kw):
        """InsertSpacer(int index, int size) --> SizerItem

        Insert a spacer at position index that is (size, size) pixels."""
        if args and type(args[0]) == int:
            return self.Insert( index, (args[0],args[0] ), 0)
        else: %# otherwise stay compatible with old InsertSpacer
            return self.Insert(index, *args, **kw)

                   
    def AddStretchSpacer(self, prop=1):
        """AddStretchSpacer(int prop=1) --> SizerItem

        Add a stretchable spacer."""
        return self.Add((0,0), prop)
    def PrependStretchSpacer(self, prop=1):
        """PrependStretchSpacer(int prop=1) --> SizerItem

        Prepend a stretchable spacer."""
        return self.Prepend((0,0), prop)
    def InsertStretchSpacer(self, index, prop=1):
        """InsertStretchSpacer(int index, int prop=1) --> SizerItem

        Insert a stretchable spacer."""
        return self.Insert(index, (0,0), prop)

            
    %# for backwards compatibility only, please do not use in new code
    def AddWindow(self, *args, **kw):
        """Compatibility alias for `Add`."""
        return self.Add(*args, **kw)
    def AddSizer(self, *args, **kw):
        """Compatibility alias for `Add`."""
        return self.Add(*args, **kw)

    def PrependWindow(self, *args, **kw):
        """Compatibility alias for `Prepend`."""
        return self.Prepend(*args, **kw)
    def PrependSizer(self, *args, **kw):
        """Compatibility alias for `Prepend`."""
        return self.Prepend(*args, **kw)

    def InsertWindow(self, *args, **kw):
        """Compatibility alias for `Insert`."""
        return self.Insert(*args, **kw)
    def InsertSizer(self, *args, **kw):
        """Compatibility alias for `Insert`."""
        return self.Insert(*args, **kw)

    def RemoveWindow(self, *args, **kw):
        """Compatibility alias for `Remove`."""
        return self.Remove(*args, **kw)
    def RemoveSizer(self, *args, **kw):
        """Compatibility alias for `Remove`."""
        return self.Remove(*args, **kw)
    def RemovePos(self, *args, **kw):
        """Compatibility alias for `Remove`."""
        return self.Remove(*args, **kw)

    }


    %nokwargs SetDimension;
    DocDeclStr(
        void , SetDimension( int x, int y, int width, int height ),
        "Call this to force the sizer to take the given dimension and thus
force the items owned by the sizer to resize themselves according to
the rules defined by the parameter in the `Add`, `Insert` or `Prepend`
methods.", "");

    void SetDimension(const wxPoint& pos, const wxSize& size);
    
    size_t GetItemCount() const;
    bool IsEmpty() const;

    DocDeclStr(
        void , SetMinSize( const wxSize &size ),
        "Call this to give the sizer a minimal size. Normally, the sizer will
calculate its minimal size based purely on how much space its children
need. After calling this method `GetMinSize` will return either the
minimal size as requested by its children or the minimal size set
here, depending on which is bigger.", "");


    DocDeclStr(
        wxSize , GetSize(),
        "Returns the current size of the space managed by the sizer.", "");

    DocDeclStr(
        wxPoint , GetPosition(),
        "Returns the current position of the sizer's managed space.", "");

    DocDeclStr(
        wxSize , GetMinSize(),
        "Returns the minimal size of the sizer. This is either the combined
minimal size of all the children and their borders or the minimal size
set by `SetMinSize`, depending on which is bigger.

Note that the returned value is *client* size, not window size.  In
particular, if you use the value to set toplevel window's minimal or
actual size, use `wx.Window.SetMinClientSize` or
`wx.Window.SetClientSize`, *not* `wx.Window.SetMinSize` or
`wx.Window.SetSize`.", "");


    %pythoncode {
    def GetSizeTuple(self):
        return self.GetSize().Get()
    def GetPositionTuple(self):
        return self.GetPosition().Get()
    def GetMinSizeTuple(self):
        return self.GetMinSize().Get()
    }

    DocDeclStr(
        virtual void , RecalcSizes(),
        "Using the sizes calculated by `CalcMin` reposition and resize all the
items managed by this sizer.  You should not need to call this directly as
it is called by `Layout`.", "");

    DocDeclStr(
        virtual wxSize , CalcMin(),
        "This method is where the sizer will do the actual calculation of its
children's minimal sizes.  You should not need to call this directly as
it is called by `Layout`.", "");


    DocDeclStr(
        void , Layout(),
        "This method will force the recalculation and layout of the items
controlled by the sizer using the current space allocated to the
sizer.  Normally this is called automatically from the owning window's
EVT_SIZE handler, but it is also useful to call it from user code when
one of the items in a sizer change size, or items are added or
removed.", "");

    
    DocDeclStr(
        wxSize , ComputeFittingClientSize(wxWindow *window),
        "Computes client area size for ``window`` so that it matches the
sizer's minimal size. Unlike `GetMinSize`, this method accounts for
other constraints imposed on ``window``, namely display's size
(returned size will never be too large for the display) and maximum
window size if previously set by `wx.Window.SetMaxSize`.

The returned value is suitable for passing to
`wx.Window.SetClientSize` or `wx`Window.SetMinClientSize`.", "");
    
    DocDeclStr(
        wxSize , ComputeFittingWindowSize(wxWindow *window),
        "Like `ComputeFittingClientSize`, but converts the result into *window*
size.

The returned value is suitable for passing to `wx.Window.SetSize` or
`wx.Window.SetMinSize`.
", "");

    
    DocDeclStr(
        wxSize , Fit( wxWindow *window ),
        "Tell the sizer to resize the *window* to match the sizer's minimal
size. This is commonly done in the constructor of the window itself in
order to set its initial size to match the needs of the children as
determined by the sizer.  Returns the new size.

For a top level window this is the total window size, not the client size.", "");

    DocDeclStr(
        void , FitInside( wxWindow *window ),
        "Tell the sizer to resize the *virtual size* of the *window* to match the
sizer's minimal size. This will not alter the on screen size of the
window, but may cause the addition/removal/alteration of scrollbars
required to view the virtual area in windows which manage it.

:see: `wx.ScrolledWindow.SetScrollbars`
", "");


    DocDeclStr(
        void , SetSizeHints( wxWindow *window ),
        "Tell the sizer to set (and `Fit`) the minimal size of the *window* to
match the sizer's minimal size. This is commonly done in the
constructor of the window itself if the window is resizable (as are
many dialogs under Unix and frames on probably all platforms) in order
to prevent the window from being sized smaller than the minimal size
required by the sizer.", "");
    
    DocDeclStr(
        void , SetVirtualSizeHints( wxWindow *window ),
        "Tell the sizer to set the minimal size of the window virtual area to
match the sizer's minimal size. For windows with managed scrollbars
this will set them appropriately.

:see: `wx.ScrolledWindow.SetScrollbars`
", "");
    %pythoncode { SetVirtualSizeHints = wx.deprecated(SetVirtualSizeHints) }


    DocDeclStr(
        void , Clear( bool deleteWindows=false ),
        "Clear all items from the sizer, optionally destroying the window items
as well.", "");

    DocDeclStr(
        void , DeleteWindows(),
        "Destroy all windows managed by the sizer.", "");

    DocDeclStr(
        virtual bool , InformFirstDirection( int direction, int size, int availableOtherDir ),
        "Inform sizer about the first direction that has been decided (by
parent item).  Returns true if it made use of the informtion (and
recalculated min size).", "");
    

    DocStr(GetChildren,
           "Returns all of the `wx.SizerItem` objects managed by the sizer in a
list-like object.", "");
    wxSizerItemList& GetChildren();


    %extend {
        DocAStr(Show,
                "Show(self, item, bool show=True, bool recursive=false) -> bool",
                "Shows or hides an item managed by the sizer.  To make a sizer item
disappear or reappear, use Show followed by `Layout`.  The *item*
parameter can be either a window, a sizer, or the zero-based index of
the item.  Use the recursive parameter to show or hide an item in a
subsizer.  Returns True if the item was found.", "");
        bool Show(PyObject* item, bool show = true, bool recursive=false) {
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
            wxPyEndBlockThreads(blocked);
            if ( info.window )
                return self->Show(info.window, show, recursive);
            else if ( info.sizer )
                return self->Show(info.sizer, show, recursive);
            else if ( info.gotPos )
                return self->Show(info.pos, show);
            else
                return false;
        }

        DocAStr(IsShown,
                "IsShown(self, item)",
                "Determines if the item is currently shown. To make a sizer
item disappear or reappear, use Show followed by `Layout`.  The *item*
parameter can be either a window, a sizer, or the zero-based index of
the item.", "");
        bool IsShown(PyObject* item) {
            wxPyBlock_t blocked = wxPyBeginBlockThreads();
            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
            wxPyEndBlockThreads(blocked);
            if ( info.window )
                return self->IsShown(info.window);
            else if ( info.sizer )
                return self->IsShown(info.sizer);
            else if ( info.gotPos )
                return self->IsShown(info.pos);
            else
                return false;
        }
    }

    %pythoncode {
    def Hide(self, item, recursive=False):
        """
        A convenience method for `Show` (item, False, recursive).
        """
        return self.Show(item, False, recursive)
    }


    DocDeclStr(
        void , ShowItems(bool show),
        "Recursively call `wx.SizerItem.Show` on all sizer items.", "");

    %property(Children, GetChildren, doc="See `GetChildren`");
    %property(ContainingWindow, GetContainingWindow, SetContainingWindow, doc="See `GetContainingWindow` and `SetContainingWindow`");
    %property(MinSize, GetMinSize, SetMinSize, doc="See `GetMinSize` and `SetMinSize`");
    %property(Position, GetPosition, doc="See `GetPosition`");
    %property(Size, GetSize, doc="See `GetSize`");
};


//---------------------------------------------------------------------------
// Use this one for deriving Python classes from
%{
// See pyclasses.h
IMP_PYCALLBACK___pure(wxPySizer, wxSizer, RecalcSizes);
IMP_PYCALLBACK_wxSize__pure(wxPySizer, wxSizer, CalcMin);
IMPLEMENT_DYNAMIC_CLASS(wxPySizer, wxSizer);
%}


DocStr(wxPySizer,
"wx.PySizer is a special version of `wx.Sizer` that has been
instrumented to allow the C++ virtual methods to be overloaded in
Python derived classes.  You would derive from this class if you are
wanting to implement a custom sizer in Python code.  Simply implement
`CalcMin` and `RecalcSizes` in the derived class and you're all set.
For example::

    class MySizer(wx.PySizer):
         def __init__(self):
             wx.PySizer.__init__(self)

         def CalcMin(self):
             for item in self.GetChildren():
                  # calculate the total minimum width and height needed
                  # by all items in the sizer according to this sizer's
                  # layout algorithm.
                  ...
             return wx.Size(width, height)

          def RecalcSizes(self):
              # find the space allotted to this sizer
              pos = self.GetPosition()
              size = self.GetSize()
              for item in self.GetChildren():
                  # Recalculate (if necessary) the position and size of
                  # each item and then call item.SetDimension to do the
                  # actual positioning and sizing of the items within the
                  # space alloted to this sizer.
                  ...
                  item.SetDimension(itemPos, itemSize)


When `Layout` is called it first calls `CalcMin` followed by
`RecalcSizes` so you can optimize a bit by saving the results of
`CalcMin` and reusing them in `RecalcSizes`.

:see: `wx.SizerItem`, `wx.Sizer.GetChildren`

", "");
class wxPySizer : public wxSizer {
public:
    %pythonAppend wxPySizer "self._setOORInfo(self);" setCallbackInfo(PySizer)

    DocCtorStr(
        wxPySizer(),
        "Creates a wx.PySizer.  Must be called from the __init__ in the derived
class.", "");

    void _setCallbackInfo(PyObject* self, PyObject* _class);
};


//---------------------------------------------------------------------------
%newgroup;


DocStr(wxBoxSizer,
"The basic idea behind a box sizer is that windows will most often be
laid out in rather simple basic geometry, typically in a row or a
column or nested hierarchies of either.  A wx.BoxSizer will lay out
its items in a simple row or column, depending on the orientation
parameter passed to the constructor.", "

It is the unique feature of a box sizer, that it can grow in both
directions (height and width) but can distribute its growth in the
main direction (horizontal for a row) *unevenly* among its children.
This is determined by the proportion parameter give to items when they
are added to the sizer. It is interpreted as a weight factor, i.e. it
can be zero, indicating that the window may not be resized at all, or
above zero. If several windows have a value above zero, the value is
interpreted relative to the sum of all weight factors of the sizer, so
when adding two windows with a value of 1, they will both get resized
equally and each will receive half of the available space after the
fixed size items have been sized.  If the items have unequal
proportion settings then they will receive a coresondingly unequal
allotment of the free space.

:see: `wx.StaticBoxSizer`
");

class  wxBoxSizer : public wxSizer {
public:
    %pythonAppend wxBoxSizer "self._setOORInfo(self)"

    DocCtorStr(
        wxBoxSizer(int orient = wxHORIZONTAL),
        "Constructor for a wx.BoxSizer. *orient* may be one of ``wx.VERTICAL``
or ``wx.HORIZONTAL`` for creating either a column sizer or a row
sizer.", "");


    DocDeclStr(
        int , GetOrientation(),
        "Returns the current orientation of the sizer.", "");

    DocDeclStr(
        void , SetOrientation(int orient),
        "Resets the orientation of the sizer.", "");

    bool IsVertical() const;
    
    %property(Orientation, GetOrientation, SetOrientation, doc="See `GetOrientation` and `SetOrientation`");
};

//---------------------------------------------------------------------------
%newgroup;


DocStr( wxWrapSizer,
"A box sizer that can wrap items on several lines when widths exceed
available width.", "");

enum { wxEXTEND_LAST_ON_EACH_LINE };

class wxWrapSizer: public wxBoxSizer
{
public:
    wxWrapSizer( int orient=wxHORIZONTAL, int flags=wxEXTEND_LAST_ON_EACH_LINE );
};


//---------------------------------------------------------------------------
%newgroup;


DocStr(wxStaticBoxSizer,
"wx.StaticBoxSizer derives from and functions identically to the
`wx.BoxSizer` and adds a `wx.StaticBox` around the items that the sizer
manages.  Note that this static box must be created separately and
passed to the sizer constructor.", "");

class  wxStaticBoxSizer : public wxBoxSizer {
public:
    %pythonAppend wxStaticBoxSizer "self._setOORInfo(self)"

    DocCtorStr(
        wxStaticBoxSizer(wxStaticBox *box, int orient = wxHORIZONTAL),
        "Constructor. It takes an associated static box and the orientation
*orient* as parameters - orient can be either of ``wx.VERTICAL`` or
``wx.HORIZONTAL``.", "");

    // TODO: wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString);

    DocDeclStr(
        wxStaticBox *, GetStaticBox(),
        "Returns the static box associated with this sizer.", "");

    %property(StaticBox, GetStaticBox, doc="See `GetStaticBox`");
};

//---------------------------------------------------------------------------
%newgroup;


DocStr(wxGridSizer,
"A grid sizer is a sizer which lays out its children in a
two-dimensional table with all cells having the same size.  In other
words, the width of each cell within the grid is the width of the
widest item added to the sizer and the height of each grid cell is the
height of the tallest item.  An optional vertical and/or horizontal
gap between items can also be specified (in pixels.)

Items are placed in the cells of the grid in the order they are added,
in row-major order.  In other words, the first row is filled first,
then the second, and so on until all items have been added. (If
neccessary, additional rows will be added as items are added.)  If you
need to have greater control over the cells that items are placed in
then use the `wx.GridBagSizer`.
", "");

class wxGridSizer: public wxSizer
{
public:
    %pythonAppend wxGridSizer
        "self._setOORInfo(self)
        if self.Rows == 0 and self.Cols == 0:
            self.Rows = 1"

    DocCtorStr(
        wxGridSizer( int rows=0, int cols=0, int vgap=0, int hgap=0 ),
        "Constructor for a wx.GridSizer. *rows* and *cols* determine the number
of columns and rows in the sizer - if either of the parameters is
zero, it will be calculated to from the total number of children in
the sizer, thus making the sizer grow dynamically. *vgap* and *hgap*
define extra space between all children.", "");

    DocDeclStr(
        void , SetCols( int cols ),
        "Sets the number of columns in the sizer.", "");

    DocDeclStr(
        void , SetRows( int rows ),
        "Sets the number of rows in the sizer.", "");

    DocDeclStr(
        void , SetVGap( int gap ),
        "Sets the vertical gap (in pixels) between the cells in the sizer.", "");

    DocDeclStr(
        void , SetHGap( int gap ),
        "Sets the horizontal gap (in pixels) between cells in the sizer", "");

    DocDeclStr(
        int , GetCols(),
        "Returns the number of columns in the sizer.", "");

    DocDeclStr(
        int , GetRows(),
        "Returns the number of rows in the sizer.", "");

    DocDeclStr(
        int , GetVGap(),
        "Returns the vertical gap (in pixels) between the cells in the sizer.", "");

    DocDeclStr(
        int , GetHGap(),
        "Returns the horizontal gap (in pixels) between cells in the sizer.", "");

    int GetEffectiveColsCount() const;
    int GetEffectiveRowsCount() const;

    %pythoncode {
        def CalcRowsCols(self):
            """
            CalcRowsCols() -> (rows, cols)

            Calculates how many rows and columns will be in the sizer based
            on the current number of items and also the rows, cols specified
            in the constructor.
            """
            nitems = len(self.GetChildren())
            rows = self.GetRows()
            cols = self.GetCols()
            assert rows != 0 or cols != 0, "Grid sizer must have either rows or columns fixed"
            if cols != 0:
                rows = (nitems + cols - 1) / cols
            elif rows != 0:
                cols = (nitems + rows - 1) / rows
            return (rows, cols)
    }
    
    %property(Cols, GetCols, SetCols, doc="See `GetCols` and `SetCols`");
    %property(HGap, GetHGap, SetHGap, doc="See `GetHGap` and `SetHGap`");
    %property(Rows, GetRows, SetRows, doc="See `GetRows` and `SetRows`");
    %property(VGap, GetVGap, SetVGap, doc="See `GetVGap` and `SetVGap`");
};

//---------------------------------------------------------------------------
%newgroup;

enum wxFlexSizerGrowMode
{
    // don't resize the cells in non-flexible direction at all
    wxFLEX_GROWMODE_NONE,

    // uniformly resize only the specified ones (default)
    wxFLEX_GROWMODE_SPECIFIED,

    // uniformly resize all cells
    wxFLEX_GROWMODE_ALL
};





DocStr(wxFlexGridSizer,
"A flex grid sizer is a sizer which lays out its children in a
two-dimensional table with all table cells in one row having the same
height and all cells in one column having the same width, but all
rows or all columns are not necessarily the same height or width as in
the `wx.GridSizer`.

wx.FlexGridSizer can also size items equally in one direction but
unequally (\"flexibly\") in the other. If the sizer is only flexible
in one direction (this can be changed using `SetFlexibleDirection`), it
needs to be decided how the sizer should grow in the other (\"non
flexible\") direction in order to fill the available space. The
`SetNonFlexibleGrowMode` method serves this purpose.

", "");

class wxFlexGridSizer: public wxGridSizer
{
public:
    %pythonAppend wxFlexGridSizer    
        "self._setOORInfo(self)
        if self.Rows == 0 and self.Cols == 0:
            self.Rows = 1"

    DocCtorStr(
        wxFlexGridSizer( int rows=0, int cols=0, int vgap=0, int hgap=0 ),
        "Constructor for a wx.FlexGridSizer. *rows* and *cols* determine the
number of columns and rows in the sizer - if either of the parameters
is zero, it will be calculated to from the total number of children in
the sizer, thus making the sizer grow dynamically. *vgap* and *hgap*
define extra space between all children.", "");


    DocDeclStr(
        void , AddGrowableRow( size_t idx, int proportion = 0  ),
        "Specifies that row *idx* (starting from zero) should be grown if there
is extra space available to the sizer.

The *proportion* parameter has the same meaning as the stretch factor
for the box sizers except that if all proportions are 0, then all
columns are resized equally (instead of not being resized at all).", "");

    DocDeclStr(
        void , RemoveGrowableRow( size_t idx ),
        "Specifies that row *idx* is no longer growable.", "");

    DocDeclStr(
        void , AddGrowableCol( size_t idx, int proportion = 0  ),
        "Specifies that column *idx* (starting from zero) should be grown if
there is extra space available to the sizer.

The *proportion* parameter has the same meaning as the stretch factor
for the box sizers except that if all proportions are 0, then all
columns are resized equally (instead of not being resized at all).", "");

    DocDeclStr(
        void , RemoveGrowableCol( size_t idx ),
        "Specifies that column *idx* is no longer growable.", "");

    bool IsRowGrowable( size_t idx );
    bool IsColGrowable( size_t idx );    

    DocDeclStr(
        void , SetFlexibleDirection(int direction),
        "Specifies whether the sizer should flexibly resize its columns, rows,
or both. Argument *direction* can be one of the following values.  Any
other value is ignored.

    ==============    =======================================
    wx.VERTICAL       Rows are flexibly sized.
    wx.HORIZONTAL     Columns are flexibly sized.
    wx.BOTH           Both rows and columns are flexibly sized
                      (this is the default value).
    ==============    =======================================

Note that this method does not trigger relayout.
", "");

    DocDeclStr(
        int , GetFlexibleDirection(),
        "Returns a value that specifies whether the sizer
flexibly resizes its columns, rows, or both (default).

:see: `SetFlexibleDirection`", "");



    DocDeclStr(
        void , SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode),
        "Specifies how the sizer should grow in the non-flexible direction if
there is one (so `SetFlexibleDirection` must have been called
previously). Argument *mode* can be one of the following values:

    ==========================  =================================================
    wx.FLEX_GROWMODE_NONE       Sizer doesn't grow in the non flexible direction.
    wx.FLEX_GROWMODE_SPECIFIED  Sizer honors growable columns/rows set with
                                `AddGrowableCol` and `AddGrowableRow`. In this
                                case equal sizing applies to minimum sizes of
                                columns or rows (this is the default value).
    wx.FLEX_GROWMODE_ALL        Sizer equally stretches all columns or rows in
                                the non flexible direction, whether they are
                                growable or not in the flexbile direction.
    ==========================  =================================================

Note that this method does not trigger relayout.", "");

    DocDeclStr(
        wxFlexSizerGrowMode , GetNonFlexibleGrowMode(),
        "Returns the value that specifies how the sizer grows in the
non-flexible direction if there is one.

:see: `SetNonFlexibleGrowMode`", "");


    // Read-only access to the row heights and col widths arrays
    DocDeclAStr(
        const wxArrayInt& , GetRowHeights() const,
        "GetRowHeights(self) -> list",
        "Returns a list of integers representing the heights of each of the
rows in the sizer.", "");

    DocDeclAStr(
        const wxArrayInt& , GetColWidths() const,
        "GetColWidths(self) -> list",
        "Returns a list of integers representing the widths of each of the
columns in the sizer.", "");


    %property(ColWidths, GetColWidths, doc="See `GetColWidths`");
    %property(FlexibleDirection, GetFlexibleDirection, SetFlexibleDirection, doc="See `GetFlexibleDirection` and `SetFlexibleDirection`");
    %property(NonFlexibleGrowMode, GetNonFlexibleGrowMode, SetNonFlexibleGrowMode, doc="See `GetNonFlexibleGrowMode` and `SetNonFlexibleGrowMode`");
    %property(RowHeights, GetRowHeights, doc="See `GetRowHeights`");
    
};

//---------------------------------------------------------------------------

DocStr(wxStdDialogButtonSizer,
"A special sizer that knows how to order and position standard buttons
in order to conform to the current platform's standards.  You simply
need to add each `wx.Button` to the sizer, and be sure to create the
buttons using the standard ID's.  Then call `Realize` and the sizer
will take care of the rest.
", "");

class wxStdDialogButtonSizer: public wxBoxSizer
{
public:
    DocCtorStr(
        wxStdDialogButtonSizer(),
        "", "");

    DocDeclStr(
        void , AddButton(wxButton *button),
        "Use this to add the buttons to this sizer.  Do not use the `Add`
method in the base class.", "");

    DocDeclStr(
        void , Realize(),
        "This funciton needs to be called after all the buttons have been added
to the sizer.  It will reorder them and position them in a platform
specifc manner.", "");

    void SetAffirmativeButton( wxButton *button );
    void SetNegativeButton( wxButton *button );
    void SetCancelButton( wxButton *button );

    wxButton* GetAffirmativeButton() const;
    wxButton* GetApplyButton() const;
    wxButton* GetNegativeButton() const;
    wxButton* GetCancelButton() const;
    wxButton* GetHelpButton() const;

    %property(AffirmativeButton, GetAffirmativeButton, SetAffirmativeButton, doc="See `GetAffirmativeButton` and `SetAffirmativeButton`");
    %property(ApplyButton, GetApplyButton, doc="See `GetApplyButton`");
    %property(CancelButton, GetCancelButton, SetCancelButton, doc="See `GetCancelButton` and `SetCancelButton`");
    %property(HelpButton, GetHelpButton, doc="See `GetHelpButton`");
    %property(NegativeButton, GetNegativeButton, SetNegativeButton, doc="See `GetNegativeButton` and `SetNegativeButton`");
};


//---------------------------------------------------------------------------