File: vrefch7.tex

package info (click to toggle)
v1 1.17-4
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,812 kB
  • ctags: 6,780
  • sloc: cpp: 43,604; ansic: 5,003; makefile: 955; sh: 30
file content (2742 lines) | stat: -rw-r--r-- 97,288 bytes parent folder | download
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
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
%***********************************************************************
%***********************************************************************
%***********************************************************************
\chapter {Drawing}

This chapter covers classes and utility functions needed to draw
text and graphics.

The classes and objects covered in this chapter include:

\begin{description}
	\item[Introduction to Drawing] Basic \V\ drawing model.
	\item[Fonts] Various screen fonts are available in \V\@.
	\item[vBrush] A brush for filling areas.
	\item[vCanvasPaneDC] The canvas pane drawing canvas.
	\item[vCanvasPane] A base class to build graphical and text canvas panes.
	\item[vBaseGLCanvasPane] A specialized class to support OpenGL.
	\item[vColor] A class for specifying colors.
	\item[vDC] A base class describing drawing canvas methods.
	\item[vMemoryDC] A memory drawing canvas.
	\item[vPen] A drawing pen.
	\item[vPrintDC] A printer drawing canvas.
	\item[vPrinter] A printer setup dialog.
	\item[vTextCanvasPane] A class for drawing text on a canvas. 
	\item[vTextEditor] A class for editing text.
	\item[vBaseGLCanvasPane] A class to support OpenGL.
\end{description}

%------------------------------------------------------------------------
\Class{Introduction to Drawing}
\index{drawing}

The basic \V\ model of drawing is a canvas. \V\ supports several kinds
of drawing canvases. The most obvious canvas is the screen drawing canvas.
This will often be the main or even only canvas you use. \V\ also
supports printing canvases. Each kind of canvas has identical drawing
methods, so you can write code to draw that is mostly independent of
which kind of canvas is being used.

There is also a specialized drawing canvas to support OpenGL. This
class differs somewhat from the other drawing canvases.
\index{OpenGL}

\subsection* {Drawing with the vDC Class}
\Indextt{vDC}

You draw to the various canvases using a \code{vDC} class, the
general \V\ Drawing Canvas Class (the OpenGL canvas does not use
the code{vDC} class). The \code{vDC} class for drawing to the
screen is \code{vCanvasPaneDC}. The class \code{vPrintDC} is the
platform independent class to draw to a printer. For X, \code{vPrintDC}
supports PostScript printing. The Windows version supports
standard Windows printers. (You can also use the PostScript DC
independently on Windows.) If you write your drawing code to use
a \code{vDC} pointer, you will be able to draw to several
canvases just by changing the value of the pointer.

Each \code{vDC} supports the methods described in the \code{vDC} section.
Because the \code{vCanvasPane} class is so central to most
applications, it duplicates
all the \code{vDC} methods so you can call them directly from your
\code{vCanvasPane} object. In fact, all the methods in \code{vCanvasPane}
are just calls to the corresponding \code{vDC} using the \code{vCanvasPaneDC}
of the canvas pane. You can get the \code{vCanvasPaneDC} pointer with
the \code{GetDC} method.

There are three kinds of drawing methods supported by \V\@. The simplest
methods draw lines of various widths and colors using the current
\code{vPen}. You change the color and width of the lines being drawn
by setting the current \code{vPen} with the \code{SetPen} method.

The second type of drawing includes filling the space surrounded
by a shape such as a polygon. The edges of the shape are drawn using
the current \code{vPen}. The filled area is drawn using the current
\code{vBrush}. You can set various attributes of the brush, and use
\code{SetBrush} to change how the shapes will be filled, as well as
changing the attributes of the \code{vPen} used to draw the surrounding
line. Both the pen and the brush can be transparent, allowing you to
draw unfilled outline shaped, or to fill a shape without an outline.

Finally, \V\ supports drawing of text on a canvas using various
\code{vFonts} and text attributes. The canvas pane will start out
using the default system font (\code{vfSystemDefault}). If you need
a different initial font, use \code{vFont::SetFontValues} to
select the font you want, then \code{vCanvasPane::SetFont} to set
the new font.

\subsection{Coordinates}

All \V\ drawing canvas classes use integer physical coordinates
appropriate to the canvas. All devices call the upper left corner
x,y coordinate of the drawing canvas 0,0. The x values increase
to the right, and y values increase down.

It it up to each application to provide appropriate mapping
from the coordinates used for the particular model being used
(often called the world coordinate system) to the physical
mapping used by each \V\ drawing canvas. Each drawing canvas
will have a physical limit for the maximum x and maximum y,
usually imposed by the particular canvas (a screen or a paper
size, for example). You can set a scale factor for each drawing
canvas which can be helpful for using different kinds of drawing
canvases. \V\ also supports setting an x,y translation. This will
allow you to more easily use the scroll bars and set margins
on printers. Your application can usually use the messages
received from the scroll bars to set the translation coordinates
to map your the canvas to a different drawing area. The system
will handle clipping.

However, the application is for the most part responsible
for determining all coordinate mapping -- translations of
a viewport of the drawing, determining the scaling for
various drawing canvases, and any mapping from the world
to the physical coordinates. The application will have to
map the mouse input accordingly, too.

%------------------------------------------------------------------------

\Class{Fonts}
\index{fonts}
\Indextt{vFont}

Various screen fonts are available in \V\@.

\subsection* {Synopsis}

\begin{description}
	\item [Class:] \code{vFont}
	\item [Header:] \code{<v/vfont.h>}
\end{description}

\subsection* {Description}

Fonts are difficult to make portable. \V\ has adopted a font
model that is somewhat portable, yet allows you to take advantage
of various fonts available on different platforms. In fact, it
is possible to write your programs to use the \code{vFontSelect}
dialog class, and pretty much ignore many of the details of
selecting fonts. The main characteristics of fonts your program
will have to deal with are the height and width of text displayed
on a canvas. These values are provided by 
\code{vDC::TextHeight} and \code{vDC::TextWidth}.

Fonts are associated with drawing canvases. For example, the
\code{vCanvasPane::SetFont} method is used to set the font used
by the canvas pane. The sizes of the actual fonts will probably
differ on different kinds of canvases. Specifically, your program
should not depend on getting the same \code{TextWidth} value
for screen and printer canvases for the same font.

The class \code{vFont} is used to define font objects, and the
characteristics of the font are set either by the class
constructor when the font is instantiated, or by using the  
\code{vFont :: SetFontValues} method. The utility class \code{vFontSelect}
can be used to interactively set font characteristics.  The
characteristics associated with a font are described in the
following sections. Remember, however, that \code{vFontSelect::FontSelect}
can be used to set these attributes.

\subsubsection*{Font Family}

Each font belongs to a font family. There are eight font families
defined by \V\@ with the \code{vFontID} attribute of the font object.
Font families typically correspond to some typeface name such
as \emph{Helvetica} or \emph{Times Roman}, but use more generic names.
There are three system fonts, \code{vfDefaultSystem}, \code{vfDefaultFixed},
and \code{vfDefaultVariable}. These default fonts are defined by
the specific platform. \code{vfDefaultSystem} will usually be a
fixed space font, and is often settable by the user. On X, for
example, the default system font can be changed by using a
\code{-fn fontname} switch when starting the application. The
\code{vfDefaultSystem} font will have fixed attributes, and will
not be changeable by the program. The \code{vfDefaultFixed}
(fixed spacing) and  \code{vfDefaultVariable} (variable spacing)
fonts are also system specified, but can usually have their
attributes, such as size and weight changed.

\V\ also supports five other font families. The \code{vfSerif} font
is a seriffed font such as \code{Times Roman}. The \code{vfSanSerif}
is a serifless font such as \code{Swiss} or \code{Lucidia}. Both
of these are variable spaced fonts. The \code{vfFixed} is a fixed
space font, often called \code{Courier} on the host platform.
The \code{vfDecorative} font usually contains symbols or other drawing
characters. It is not very portable across platforms. Finally,
\V\ supports a font family called \code{vfOther}. This is used when
the system supports other fonts that are selectable via the
\code{vFontSelect} dialog class. Windows supports a wide variety of fonts,
while X does not support any additional fonts.

\subsubsection*{Font Style}

\V\ supports two kinds of font styles: \code{vfNormal} for normal
fonts, and \code{vfItalic} for italic fonts.

\subsubsection*{Font Weight}

\V\ supports two kinds of font weights: \code{vfNormal} for
normal weight fonts, and \code{vfBold} for boldface fonts.

\subsubsection*{Point Size}

\V\ supports a wide range of point size, usually ranging from 8 point
to 40 or 72 point fonts. Not all point sizes are supported on each
platform. How each point size maps to space on the screen or page
also vary from platform to platform.

\subsubsection*{Underlining}

You can also specify that a font is underlined. Currently, underlining
does not work for X screens.

\subsection* {Methods}

\Meth{vFont(vFontID fam = vfDefaultFixed, int size = 10,
vFontID sty = vfNormal, vFontID wt = vfNormal, int und = 0)}
\Indextt{vFont}

The constructor is used to declare a font with the specified
family, size, style, weight, and underline.

\Meth{vFontID GetFamily()}
\Indextt{GetFamily}

Returns the family of the font object.

\Meth{int GetPointSize()}
\Indextt{GetPointSize}

Returns the point size of the font object.

\Meth{vFontID GetStyle()}
\Indextt{GetStyle}

Returns the style of the font object.

\Meth{vFontID GetWeight()}
\Indextt{GetWeight}

Returns the weight of the font object.

\Meth{int GetUnderlined()}
\Indextt{GetUnderlined}

Returns the underline setting of the font object.

\Meth{void SetFontValues(vFontID fam = vfDefaultFixed, int size =
10, vFontID sty = vfNormal, vFontID wt = vfNormal, int und = 0)}
\Indextt{SetFontValues}

Changes the attributes of the font object. For example, the font
selection dialog uses this method to change the font attributes.

%------------------------------------------------------------------------

\Class{vBrush}
\Indextt{vBrush}\index{brush}

A class to specify the brush used to fill shapes.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vbrush.h>}
	\item [Class name:] vBrush
\end{description}

\subsection* {Description}

Brushes are used to fill shapes. Brushes have
two attributes, including color and style.

\subsection* {Methods}

\Meth{vBrush(unsigned int r = 0, unsigned int g = 0, unsigned
int b = 0, int style = vSolid)}
\Indextt{vBrush}

The brush constructor allows you to set the initial color and
style of the brush. The default constructs a solid black brush.

\Meth{int operator == , !=}

You can use the operators \code{==} and \code{!=} for comparisons.

\Meth{vColor GetColor()}
\Indextt{GetColor}

This method returns the current color of the brush as a \code{vColor} object.

\Meth{int GetFillMode()}
\Indextt{GetFillMode}

This method returns the fill mode of the brush (either \code{vAlternate}
or \code{vWinding}).

\Meth{int GetStyle()}
\Indextt{GetStyle}

This method returns the current style of the brush.

\Meth{void SetColor(vColor\& c)}
\Indextt{SetColor}
\index{color!brush}

You can use this method to set the brush color by passing
in a \code{vColor} object.

\Meth{int SetFillMode(int fillMode)}
\Indextt{SetFillMode}

This method sets the fill mode of the brush.
The fillMode parameter specifies one of two alternative filling
algorithms, \code{vAlternate} or \code{vWinding}. These algorithms correspond
to the equivalent algorithms on the native platforms.

\Meth{void SetStyle(int style)}
\Indextt{SetStyle}

This method is used to set the style of the brush. Brush styles
include:

\begin{description}
	\item [vSolid] The brush fills with a solid color.
	\item [vTransparent] The brush is transparent, which allows
you to draw unfilled shapes.
	\item [vHorizontalHatch] The brush fills with a horizontal hatch pattern
in the current color.
	\item [vVerticleHatch] The brush fills with a vertical hatch pattern.
	\item [vLeftDiagonalHatch] The brush fills with a left leaning
diagonal hatch pattern.
	\item [vRightDiagonalHatch] The brush fills with a right
leaning diagonal hatch pattern.
	\item [vCrossHatch] The brush fills with a vertical and horizontal cross hatch
pattern.
	\item [vDiagonalCrossHatch] The brush fills with a diagonal
cross hatch pattern.
\end{description}

%------------------------------------------------------------------------

\Class{vCanvasPaneDC}
\Indextt{vCanvasPaneDC}

The drawing canvas class for CanvasPanes.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vcpdc.h>}
	\item [Class name:] vCanvasPaneDC
 	\item [Hierarchy:] vDC \rta vCanvasPaneDC
\end{description}

\subsection* {Description}

This class is normally automatically used by the \code{vCanvasPane}
class. It provides the actual implementation of the screen drawing
canvas class. 

%------------------------------------------------------------------------

\Class{vCanvasPane}
\Indextt{vCanvasPane}

A base class to build graphical and text canvas panes.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vcanvas.h>}
	\item [Class name:] vCanvasPane
 	\item [Hierarchy:] vPane \rta vCanvasPane
\end{description}

\subsection* {Description}

This is the base drawing class. You use it to build more complicated
drawing canvases, either for graphical drawing or text drawing.
The \code{vCanvasPane} class has all the basic methods needed to
interact with the drawing canvas. It does not, however, know
how to handle repainting the screen on \code{Redraw} or \code{Resize}
events. It provides utility methods for drawing on the canvas,
and several other methods that are normally overridden by your
application.

See the section \code{vPane} for a general description of panes.

\subsection* {Utility Methods}

The following methods provide useful service without modification. Sometimes
you will want to override some of these, but you will then usually
call these methods from your derived class.

%............................................................
\Meth{Drawing}
\index{drawing}

The \code{vCanvasPane} normally creates a \code{vCanvasPaneDC} to
use for drawing, and class provides direct support by including
direct calls for the drawing methods described in the \code{vDC}
section. If your drawing will only be to the screen, then you
can use the methods of the \code{vCanvasPane} class directly.
Each of these methods is really an inline function that expands
to \code{\_cpDC->DrawWhatever()}.

If your drawing code might want to draw to both a screen and
a printer, you might want to use a parameter to the appropriate
drawing canvas. You can get the \code{vDC} used by the \code{vCanvasPane}
by calling \code{GetDC()}.

%............................................................
\Meth{virtual void CreateDC(void)}
\Indextt{CreateDC}

This method is called when the \code{vCanvasPane} is initialized.
The default is to create a drawing canvas using \code{\_cpDC = new
vCanvasPaneDC(this);}. If you want to derive a different canvas
pane class from \code{vCanvasPane} perhaps using a more
sophisticated drawing canvas derived from the \code{vCanvasPaneDC}
class, you can override the \code{CreateDC} method and set the
protected \code{vDC* \_cpDC} pointer to an instance of your new
drawing canvas (e.g., \code{\_cpDC = new myCanvasPaneDC(this)}
instead.

%............................................................
\Meth{vDC* GetDC()}
\Indextt{GetDC}

Returns a pointer to the \code{vDC} of the current drawing canvas. The
\code{vDC} can be used for most of the drawing methods to achieve
drawing canvas independence. If your code draws via a \code{vDC} pointer,
then the same code can draw to the screen canvas or the printer canvas
depending on what the \code{vDC} points to.

%............................................................
\Meth{VCursor GetCursor()}
\Indextt{GetCursor}

Returns the id of the current cursor being used in the canvas.
See \code{SetCursor}.

%............................................................
\Meth{virtual int GetHeight()}
\Indextt{GetHeight}

Returns the height of the current drawing canvas in pixels.

%............................................................
\Meth{virtual int GetHScroll(int\& Shown, int\& Top)}
\Indextt{GetHScroll}

Get the status of the Horizontal Scroll bar. Returns 1 if the
scroll bar is displayed, 0 if not. Returns in \code{Shown} and
\code{Top} the current values of the scroll bar. See \code{SetVScroll}
for a description of the meanings of parameters.

%............................................................
\Meth{virtual int GetVScroll(int\& Shown, int\& Top)}
\Indextt{GetVScroll}

Get the status of the Vertical Scroll bar. See
\code{GetHScroll} for details.

%............................................................
\Meth{virtual int GetWidth()}
\Indextt{GetWidth}

Returns the width of the current drawing canvas in pixels.
This is either the initial size of the window, or the size
after the user has resized the window.

%............................................................
\Meth{void SetCursor(VCursor id)}
\Indextt{SetCursor}

This method sets the cursor displayed while the mouse in
in the current canvas area. The default cursor is the
standard arrow cursor used on most host platforms. You
can change the cursor displayed within the canvas area
only by calling this method.

The cursors currently supported include:

\begin{description}

\item[VC\_Arrow] The standard arrow cursor.
\item[VC\_CenterArrow] An upward point arrow.
\item[VC\_CrossHair] A cross hair cursor.
\item[VC\_EWArrows] Double ended horizontal arrows (EastWest).
\item[VC\_Hand] A hand with a pointing finger (NOT ON WINDOWS).
\item[VC\_IBar] An I bar cursor.
\item[VC\_Icon] A cursor representing an icon.
\item[VC\_NSArrows] Double ended vertical arrows (NorthSouth).
\item[VC\_Pencil] A pencil (NOT ON WINDOWS).
\item[VC\_Question] A question mark cursor (NOT ON WINDOWS).
\item[VC\_Sizer] The cursor used for sizing windows.
\item[VC\_Wait] A cursor that symbolizes waiting, usually an hour glass.
\item[VC\_X] An X shaped cursor (NOT ON WINDOWS).
\end{description}

%............................................................
\Meth{void SetWidthHeight(int width, int height)}
\Indextt{SetWidthHeight}

This will set the size of the drawing canvas to \code{height}
and \code{width} in pixels. It will also cause a \code{Resize}
event message to be sent to the window.

%............................................................
\Meth{virtual void SetHScroll(int Shown, int Top)}
\Indextt{SetHScroll}

Set the horizontal scroll bar. See \code{SetVScroll} for
a description of the parameters.

%............................................................
\Meth{virtual void SetVScroll(int Shown, int Top)}
\Indextt{SetVScroll}\index{scroll bars}

Set the vertical scroll bar. The \code{Shown} parameter
is a value from 0 to 100, and represents the percent
of the scroll bar shows of the view in the canvas. For
example, the canvas might be displaying text from a file.
If the file was 100 lines long, and the window could show
20 lines, then the value of \code{Shown} would be 20,
meaning that the canvas is showing 20 percent of the file.
As the size of the data viewed in the canvas changes, your
program should change the scroll bar to corresponding values.

The \code{Top} parameter represents where the top of
the scroll indicator should be placed.  For example,
if the first line displayed in the canvas of a 100 line file
was line 40, then  \code{Top} should be 40, representing
40 percent.

This model of a scroll bar can be mapped to all the underlying
windowing systems supported by \V, but the visual appearance
of the scroll bar will vary.

%............................................................
\Meth{virtual void ShowHScroll(int OnOrOff)}
\Indextt{ShowHScroll}
\Meth{virtual void ShowVScroll(int OnOrOff)}
\Indextt{ShowVScroll}\index{scroll bars}

When a canvas is first displayed, it will begin with both
horizontal and scroll bars not shown by default. \code{ShowHScroll}
and \code{ShowVScroll} can be used to selectively turn on and off
the canvas scroll bars. When a scroll bar is turned off or on, the size
of the canvas may changes, so you should also call \code{Resize} after
you have set the scroll bars.

You must not call either of these methods until the canvas has
actually been instantiated on the screen. This means if your
application needs to start with scroll bars, you should have
the calls to \code{ShowVScroll} and \code{ShowHScroll} in
the code of your \code{vCmdWindow} class constructor
(or other initialization code) \emph{after} calling
\code{vWindow::ShowWindow} in your class constructor.

\subsection* {Methods to Override} %------------------------

%............................................................
\Meth{virtual void FontChanged(int vf)}
\Indextt{FontChanged}

Called when the font is changed. This usually means your
application needs to resize the window and recalculate
the number of rows and columns of text that can be displayed.

%............................................................
\Meth{virtual void HPage(int Shown, int Top)}
\Indextt{HPage}

When the user moves the horizontal scroll bar, it generates an
\code{HPage} event. It is up to your program to intercept (override)
this method, and provide proper interpretation. This event usually
is used for large movements. The meaning of \code{Shown} and
\code{Top} represent the state of the scroll bar as set by
the user.  It is then up to your program to display the
correct portion of the data shown in the canvas to correspond
to these values.  Your program uses \code{SetHScroll} to
set appropriate values, and they are explained there.
The \code{Shown} value supplied here
will correspond to the value you program set for the scroll bar.
The \code{Top} value should indicate the meaningful change as input
by the user.

%............................................................
\Meth{virtual void HScroll(int step)}
\Indextt{HScroll}

This method is called when the user enters a single step command
to the scroll bar. The value of \code{step} will be positive for right or
negative for left scroll.  These scrolls
are usually interpreted as discreet steps - either a line or
screenful at a time. It is up to your application to give
an appropriate interpretation.

%............................................................
\Meth{virtual void MouseDown(int x, int y, int button)}
\Indextt{MouseDown}

This is called when the user clicks a button on the mouse. The
\code{x} and \code{y} indicates the position of the mouse in the
canvas when the button was clicked. Mouse events in vCanvasPane
are no-ops, and your subclass of \code{vCanvasPane} will need to
handle proper interpretation of mouse clicks.

Sorry, but thanks to the Macintosh, handling of buttons is a bit
nonportable. The \code{button} parameter will have a value of 1,
2, or 3. On X based systems, 1 is the left button, 2 is the
middle button, and 3 is the right button. On Windows, 1 is the
left button, and 3 is the right button. Thus, applications using
the left and right buttons are portable from X to Windows. The
single Macintosh button will return a value of 1. 

If you intend your applications to port to all three platforms,
you will have to account for the single Macintosh button. If you
ignore X's middle button, then your applications can be directly
portable from X to Windows.

%............................................................
\Meth{virtual void MouseMotion(int x, int y)}
\Indextt{MouseMotion}

This is called when the mouse moves while a button is \emph{not}
pressed, and gives the current \code{x} and \code{y} of the
mouse. Most applications will ignore this information.

%............................................................
\Meth{virtual void MouseMove(int x, int y, int button)}
\Indextt{MouseMove}

This is called when the mouse moves while a button is pressed,
and gives the new \code{x}, \code{y}, and \code{button} of the
mouse. Mouse events in vCanvasPane are no-ops, and your subclass
needs to interpret them.
Note that scaling applies to output only. The mouse
events will provide unscaled coordinates, and it is up
to your code to scale mouse coordinates appropriately.
Mouse coordinate \emph{do} have the translation added.

%............................................................
\Meth{virtual void MouseUp(int x, int y, int button)}
\Indextt{MouseUp}

This is called when the user releases the mouse button, and
gives the final location of the mouse.
Mouse events in vCanvasPane are no-ops, and your subclass
needs to interpret them.

%............................................................
\Meth{virtual void Redraw(int x, int y, int width, int height)}
\Indextt{Redraw}

\code{Redraw} is called when the canvas needs to be redrawn.
The first redraw is generated when the canvas is first created.
Other redraws are generated when the canvas is covered or uncovered
by another window, and means the contents of the canvas must
be repainted.  The \code{vCanvasPane} does not know how to repaint
the contents of the canvas, so you must override this method to
be able to keep the canvas painted.

The parameters of \code{Redraw} represent the rectangular area
that needs to be repainted. This areas is not always the whole
canvas, and it is possible that many \code{Redraw} events will
be generated in a row as the user drags a covering window off
the canvas.

The default \code{Redraw} in \code{vCanvasPane} is a
no-op, and your subclass needs to override \code{Redraw}.

%............................................................
\Meth{virtual void Resize(int newW, int newH)}
\Indextt{Resize}

A \code{Resize} event is generated when the user changes the
size of the canvas using the resize window command provided
by the host windowing system.

The default \code{Resize} in \code{vBaseGLCanvasPane} is a
no-op, and your subclass needs to override \code{Redraw}.

%............................................................
\Meth{virtual void VPage(int Shown, int Top)}
\Indextt{VPage}

See \code{HPage}.

%............................................................
\Meth{virtual void VScroll(int step)}
\Indextt{VScroll}

This method is called when the user enters a single step command
to the vertical scroll bar. The value of \code{step} will be
positive for down or negative for up scroll.  These scrolls are
usually interpreted as discreet steps - either a line or
screenful at a time. It is up to your application to give an
appropriate interpretation.

\subsection* {See Also}

vTextCanvasPane

%------------------------------------------------------------------------
\Class{vTextEditor}
\Indextt{vTextEditor}\index{Text Editor}

A complete text editing canvas pane.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vtexted.h>}
	\item [Class name:] vTextEditor
 	\item [Hierarchy:] vCanvasPane \rta vTextCanvasPane \rta vTextEditor
\end{description}

\subsection* {Description}

This class is a completely functional line oriented text editor.
It can edit any file with lines less than 300 characters wide that
use a linefeed, carriage return, or combination of those to mark
the end of each line.

While you need to create your own class derived from \code{vTextEditor},
your class can be very minimal. You will need to provide some
service methods for the parent \code{vCmdWindow}, such as methods
to open, read, save, and close files. Other than actually working
with the real text source and providing that source to \code{vTextEditor},
you can get a fully functional text editor with no additional work.

However, \code{vTextEditor} has been designed to allow you to extend
and add functionality to the editor if you need to. The \code{vTextEditor}
also sends messages that will allow you to place various status
messages on a status bar if you wish. The hard stuff is done for you.
You don't need to worry about mouse movements, scroll bars or scroll
messages, updating the screen, handling keystrokes, or anything else
associated with actual editing. The \code{vTextEditor} class takes
care of all those details, and provides a standard editing interface.

The following steps are required to use \code{vTextEditor}. First,
you create an instance of your derived class from your \code{vCmdWindow}
class, something like this:

\footnotesize
\begin{verbatim}
   ...

   // The Text Editor Canvas
    vedCanvas = new vedTextEditor(this);
    AddPane(vedCanvas);
   ...

   // Show Window

    ShowWindow();
    vedCanvas->ShowVScroll(1);  // Show Vert Scroll for vTextEditor

    ...
\end{verbatim}
\normalfont\normalsize

Your derived \code{vTextEditor} class should provide the methods
needed for opening and reading the text file you want to edit.
(Actually, you can edit any text source you wish.) \code{VTextEditor}
doesn't actually read or write any text itself. It maintains an
internal line buffer. (The default version of the internal buffer
is essentially limited by the amount of memory your system can
provide. The buffer methods can be overridden to provide totally
unlimited file size, if you wish.) The idea is to have your
application control where the text comes from, and then
add it a line at a time to the \code{vTextEditor} buffer.
You retrieve the text a line at a time when you want to save
the edited text. Thus, your if your code is working with
disk files, it can read the text a line at a time, and let
\code{vTextEditor} worry about the buffering.

The following code shows how to add the contents of a text file
to the \code{vTextEditor} buffer, and display it in the canvas
for the first time. Calls to \code{vTextEditor} methods are
marked with **.

\footnotesize
\begin{verbatim}
//===================>>> vedTextEditor::ReadFile <<<====================
  int vedTextEditor::ReadFile(char* name)
  {
    const int maxBuff = 300;    // Line length
    char buff[maxBuff];

    if (!name || !*name)
        return 0;
    ifstream inFile(name);      // Open the file

    if (!inFile)
        return 0;               // file not there

    resetBuff();                // ** Tell vTextEditor to init buffer

    while (inFile.getline(buff,maxBuff))  // read file
      {
        if (!addLine(buff))     // ** Add the line to the buffer
          {
            ERROR_MESSAGE("File too big -- only partially read.");
            break;
          }
      }
    inFile.close();             // Close the file
    displayBuff();              // ** Now, display the buffer
    return 1;
  }
\end{verbatim}
\normalfont\normalsize

To load text into the editor buffer,
you first call \code{resetBuff} to initialize the
buffer, then add a line at a time with calls to \code{addLine},
and finally display the text by calling \code{displayBuff}.

When your are editing (e.g., the user enters a Close command),
you retrieve the text from the \code{vTextEditor} buffer
with calls to \code{getLine}.

Then, to use the editor, you pass keystrokes from the
\code{KeyIn} method of your \code{vCmdWindow} to the \code{EditKeyIn}
method of the \code{vTextEditor}. \code{EditKeyIn} interprets
the conventional meanings of the arrow keys, etc., and lets
you edit the text in the buffer. You will also probably implement
other commands, such as Find, by using the \code{EditCommand}
method.

\code{VTextEditor} also calls several methods to notify of
text state changes, such as current line, insert or overtype,
etc. You can receive these messages by overriding the default
methods, and display appropriate information on a status bar.

While \code{vTextEditor} is very complete, there are some
things missing. The major hole is cut and paste support. This
will be added when cut and paste support is added to \V. There
is also no real undo support. Maybe someday.


\subsection* {Constructor} %------------------------------------

\Meth{vTextEditor(vBaseWindow* parent)}
\Indextt{vTextEditor!constructor}

The \code{vTextEditor} constructor requires that you specify
the parent \code{vCmdWindow}. Since you usually create the text editor object
in your \code{vCmdWindow} object, this is easy. You will probably need
to cast the \code{this} to a \code{vBaseWindow*}.

\subsection* {Utility Methods} %------------------------

\Meth{resetBuff()}
\Indextt{vTextEditor!resetBuff}

Before you load new text into the buffer, you must first
call this method. It initializes the internal state of
the text buffer.

\Meth{virtual int addLine(char* line)}
\Indextt{vTextEditor!addLine}

This method is called repeatedly to add lines to the
text buffer. The default method is limited by the amount
of memory available on the system, and this method
return 0 when it runs out of memory.

Note that the entire text buffer package can be overridden
if you need to provide unlimited file size handling. You
should examine the source code for \code{vTextEditor} to
determine the specifications of the methods you'd need
to override.

\Meth{virtual void displayBuff()}
\Indextt{vTextEditor!displayBuff}

After you have added the complete file, call \code{displayBuff}
to display the text in the window.

\Meth{virtual int getLine(char* line, int maxChars, long
lineNum)}
\Meth{virtual int getFirstLine(char* line, int maxChars)}
\Indextt{vTextEditor!getFirstLine}
\Meth{virtual int getNextLine(char* line, int maxChars)}
\Indextt{vTextEditor!getNextLine}

These are used to retrieve the edited text from the buffer.
You can use \code{getFirstLine} with \code{getNextLine} for
easy sequential retrieval, or \code{getLine} for specific
lines. These methods return -1 when all lines have been
recovered.

\Meth{virtual int EditCommand(int id, long val)}
\Indextt{vTextEditor!EditCommand}

This method provides a complete interface to the functions
provided by \code{vTextEditor}. While the basic
editing functions are also handled by \code{EditKeyIn},
\code{EditCommand} gives access to functions that typically
are either usually invoked from a menu command (such as
Find), or don't have a standard mapping to a functions
key (such as lineGoto). If you want the functionality of
these commands in your application, you will have to
provide an appropriate menu or command pane item to
support them.

Each function supported by \code{vTextEditor} has an
associated id (symbolically defined in \code{v/vtexted.h}), each
beginning with \code{ed}. Many of
the functions also take an associated value. Many editors
allow a repetition count to be specified with many commands.
For example, it is sometimes useful to be able to specify
a command to move right some specific number of characters.
The \code{val} parameter can be used to specify a value
as desired. The only function that really need a value
other than 1 (or -1 in the case of directional movement
commands) is \code{edLineGoto}.

\code{EditCommand} returns 1 if the command was executed
successfully, 0 if the command was recognized, but not
successful (the find fails, for example), and -1 if
the command was not recognized as valid.

At the time this manual was written, the following commands
are supported. Because \code{vTextEditor} is evolving,
it is likely more commands will be added. Check the
\code{v/vtexted.h} file for specification of new editor
commands. In the following descriptions, the note
``no val'' means that the \code{val} parameter is not
used. A notation of ``+/-'' means the sign of \code{val}
indicates direction.

\begin{description}
\item[edBalMatch] find matching paren (if val > 1, up to val
lines away, otherwise within a reasonable range)
\item[edBufferBottom] move to bottom of file (no val)
\item[edCharDelete] delete +/- val chars
\item[edCharFoldCase] swap case of +/- val letters
\item[edCharInsert] insert char val
\item[edCharRight] move +/- val chars right
\item[edFind] invoke TextEd's find dialog (no val)
\item[edFindNext] find next occurrence of prev (no val)
\item[edLineBeginning] move to line beginning (no val)
\item[edLineDown] move down +/- val lines in column
\item[edLineDownBeg] move down +/- val lines
\item[edLineDelete] delete +/- val lines
\item[edLineDeleteFront] delete to beginning of line (no val)
\item[edLineDeleteToEnd] delete to end of line (no val)
\item[edLineEnd] move to end of line (no val)
\item[edLineGoto] move cursor to line val
\item[edLineOpen] open val new blank lines
\item[edScrollDown] scroll +/- val lines without changing cursor
\item[edVerify] force repaint of screen (no val)
\item[edWordRight] move cursor +/- val words right

\end{description}

For a basic editor, the simplest way to use \code{EditCommand}
is to use the \code{ed*} id's to define the associated menu
items and controls, and then call \code{EditCommand} as the
default case of the \code{switch} in the \code{WindowCommand}
method of your \code{vCmdWindow}. Thus, you might have
code that looks like this:

\footnotesize
\begin{verbatim}
   ...
  static vMenu EditMenu[] = {
  ...
    {"Find", edFind, isSens,notChk,noKeyLbl,noKey,noSub},
    {"Find Next", edFindNext, isSens,notChk,noKeyLbl,noKey,noSub},
    {"Find Matching Paren", edBalMatch, isSens,notChk,
      noKeyLbl,noKey,noSub},
  ...
  };

   ...

//===========>>> vedCmdWindow::WindowCommand <<<====================
 void vedCmdWindow::WindowCommand(ItemVal id, ItemVal val,
      CmdType cType)
 {
   switch (id)
    {
     ...

      default:  // route unhandled commands through editor
       {
         if (vedCanvas->EditCommand(id, 1) < 0)
            vCmdWindow::WindowCommand(id, val, cType);
        break;
       }

    }
   ...
 }

//====================>>> vedCmdWindow::KeyIn <<<====================
  void vedCmdWindow::KeyIn(vKey keysym, unsigned int shift)
  {
    if (vedCanvas->EditKeyIn(keysym, shift) < 0)
        vCmdWindow::KeyIn(keysym, shift);
  }
\end{verbatim}
\normalfont\normalsize

\Meth{virtual int EditKeyIn(vKey key, unsigned int shift)}
\Indextt{vTextEditor!EditKeyIn}

This method is usually called from the \code{KeyIn} method
of your derived \code{vCmdWindow} class. See the above code
example. 

The default implementation of \code{EditKeyIn} handles
most of the standard keys, such as
the arrow keys, the page keys, backspace, home, delete,
insert, and end keys. It will also insert regular
character keys into the text. It ignores function keys
and non-printing control key values except tab and newline.

You can override this method to provide your own look and feel
to the editor.

\Meth{edState GetEdState()}
\Indextt{vTextEditor!GetEdState}
\Meth{void SetEdState()}
\Indextt{vTextEditor!SetEdState}

\code{VTextEditor} maintains a state structure with relevant state
information associated with various operating options of \code{vTextEditor}. It is
defined in \code{v/vtexted.h}, and has the following fields:

\footnotesize
\begin{verbatim}
    typedef struct edState
      {
        long changes,           // count of changes
             cmdCount;          // how many times to repeat command
        int
            findAtBeginning,    // leave find at beginning of pattern
            fixed_scroll,       // flag if using fixed scroll
            ins_mode,           // true if insert mode
            counter,            // counter for + insert
            echof,              // whether or not to echo action
            tabspc,             // tab spacing
            wraplm;             // right limit
      } edState;
\end{verbatim}
\normalfont\normalsize

You can query and set the state with \code{GetEdState} and
\code{SetEdState}.

\Meth{long GetLines()}
\Indextt{vTextEditor!GetLines}

Returns the number of lines in the current buffer.

\subsection* {Methods to Override} %------------------------

\Meth{virtual void ChangeLoc(long line, int col)}
\Indextt{vTextEditor!ChangeLoc}

This method is called by \code{vTextEditor} whenever the current line
or current column is changed. This information could be displayed
on a status bar, for example.

\Meth{virtual void ChangeInsMode(int IsInsMode)}
\Indextt{vTextEditor!ChangeInsMode}

This method is called by \code{vTextEditor} whenever the
insert mode is changed. If \code{IsInsMode} is true, then
the editor is in insert mode. Otherwise, it is in overtype
mode. The editor starts in insert mode. This information could be displayed
on a status bar, for example.

\Meth{virtual void StatusMessage(char* Msg)}
\Indextt{vTextEditor!StatusMessage}

The editor will call this message with a non-critical message
such as ``Pattern Not Found'' for certain operations.
This information could be displayed on a status bar, for example.

\Meth{virtual void ErrorMessage(char* Msg)}
\Indextt{vTextEditor!ErrorMessage}

The editor will call this message with a critical error message
such as ``Bad parameter value'' for certain operations.
This information could be displayed in a warning dialog, for example.

\subsection* {See Also} %---------------------------------------

vTextCanvasPane
%------------------------------------------------------------------------

\Class{vBaseGLCanvasPane}
\Indextt{vBaseGLCanvasPane}\index{OpenGL}

A specialized base class to support OpenGL graphics.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vbglcnv.h>}
	\item [Class name:] vBaseGLCanvasPane
 	\item [Hierarchy:] vPane \rta vBaseGLCanvasPane
\end{description}

\subsection* {Description}

This is a specialized class to provide very basic support
for the OpenGL graphics package. Unlike other \V\ canvas
panes, this class does not use a \code{vDC} class. Instead,
it has a few features designed to support OpenGL.

This is a basic class. It does not provide many convenience
methods to support OpenGL at a high level, but it does hide
all the messy details of interfacing with the host GUI
environment, and provides the first really easy way to
generate sophisticated interfaces for OpenGL applications.
A more sophisticated class
called \code{vGLCanvasPane} that will provide a number
of convenience operations is under development, but the
base class is still very useful.

By following a standard convention to structure V/OpenGL
code, it is relatively easy to generate applications.
The details of this convention are explained in the tutorial
section of this description.

See the section \code{vPane} for a general description of panes.

\subsection* {Constructor} %------------------------------------
\Meth{vBaseGLCanvasPane(unsigned int vGLmode)}
\Indextt{vBaseGLCanvasPane()}

The \code{vBaseGLCanvasPane} constructor allows you to specify
certain attributes of the visual used by OpenGL. The options,
which can be ORed together, include:

\begin{description}

\item[vGL\_Default] Use the default visual, which includes
\code{vGL\_RGB} and \code{vGL\_DoubleBuffer}. \V\ will
use this default if you don't provide a value to the constructor.

\item[vGL\_RGB] This is the standard RGBA mode used by
most OpenGL programs. The size of the RED, GREEN, and
BLUE planes are maximized according to the capabilities
of the host machine. An ALPHA plane is not included
unless the \code{vGL\_Alpha} property is also specified.

\item[vGL\_Alpha] Used to include an APLHA plane. Not all
machines support ALPHA planes.

\item[vGL\_Indexed] Use indexed rather than RGB mode. \V\
will attempt to maximize the usefulness of the palette.
You should not specify both RGB and Indexed.

\item[vGL\_DoubleBuffer] Use Double buffering if available.
Single buffering is assumed if \code{vGL\_DoubleBuffer} is not
specified.

\item[vGL\_Stereo] Use a Stereo buffer if available.

\item[vGL\_Stencil] Use Stencil mode if available.

\item[vGL\_Accum] Use accumulation buffers if available.

\item[vGL\_Depth] Use Depth mode if available.

\end{description}

Not all of these attributes are available on all OpenGL implementations,
and \V\ will attempt to get a reasonable visual based on your
specifications. For now, the \code{vGL\_Default} mode works well
for many OpenGL applications.

\V\ supports only one visual per application, and the first
\code{vBaseGLCanvasPane} created determines the attributes of
the visual used.

\subsection* {Utility Methods} %-------------------------------

The following methods provide useful service without modification. Sometimes
you will want to override some of these, but you will then usually
call these methods from your derived class. Most of these methods
are the equivalent of the normal \V\ \code{vCanvasPane} class.

%............................................................
\Meth{VCursor GetCursor()}
\Indextt{GetCursor}

Returns the id of the current cursor being used in the canvas.
See \code{SetCursor}.

%............................................................
\Meth{virtual int GetHeight()}
\Indextt{GetHeight}

Returns the height of the current drawing canvas in pixels.

%............................................................
\Meth{virtual int GetHScroll(int\& Shown, int\& Top)}
\Indextt{GetHScroll}

Get the status of the Horizontal Scroll bar. Returns 1 if the
scroll bar is displayed, 0 if not. Returns in \code{Shown} and
\code{Top} the current values of the scroll bar. See \code{SetVScroll}
for a description of the meanings of parameters.

%............................................................
\Meth{virtual int GetVScroll(int\& Shown, int\& Top)}
\Indextt{GetVScroll}

Get the status of the Vertical Scroll bar. See
\code{GetHScroll} for details.

%............................................................
\Meth{virtual int GetWidth()}
\Indextt{GetWidth}

Returns the width of the current drawing canvas in pixels.
This is either the initial size of the window, or the size
after the user has resized the window.

%............................................................
\Meth{void SetCursor(VCursor id)}
\Indextt{SetCursor}

This method sets the cursor displayed while the mouse in
in the current canvas area.
See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{void SetWidthHeight(int width, int height)}
\Indextt{SetWidthHeight}

This will set the size of the drawing canvas to \code{height}
and \code{width} in pixels. It will also cause a \code{Resize}
event message to be sent to the window.

%............................................................
\Meth{virtual void SetHScroll(int Shown, int Top)}
\Indextt{SetHScroll}

Set the horizontal scroll bar
See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{virtual void SetVScroll(int Shown, int Top)}
\Indextt{SetVScroll}\index{scroll bars}

Set the vertical scroll bar. 
See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{virtual void ShowHScroll(int OnOrOff)}
\Indextt{ShowHScroll}
\Meth{virtual void ShowVScroll(int OnOrOff)}
\Indextt{ShowVScroll}\index{scroll bars}

See the description of \code{vCanvasPane} for details.

\subsection* {Methods to Override} %------------------------

%............................................................
\Meth{virtual void HPage(int Shown, int Top)}
\Indextt{HPage}

When the user moves the horizontal scroll bar, it generates an
\code{HPage} event. 
See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{virtual void HScroll(int step)}
\Indextt{HScroll}

This method is called when the user enters a single step command
to the scroll bar. 
See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{virtual void MouseDown(int x, int y, int button)}
\Indextt{MouseDown}

This is called when the user clicks a button on the mouse.

It is important to remember that all mouse coordinates are
in screen pixels, and use 0,0 as the upper left corner.
You will probably have to map them to the actual coordinates
in use by your OpenGL graphic.

See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{virtual void MouseMotion(int x, int y)}
\Indextt{MouseMotion}

This is called when the mouse moves while a button is \emph{not}
pressed.
See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{virtual void MouseMove(int x, int y, int button)}
\Indextt{MouseMove}

This is called when the mouse moves while a button is pressed.
See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{virtual void MouseUp(int x, int y, int button)}
\Indextt{MouseUp}

This is called when the user releases the mouse button.
See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{virtual void Redraw(int x, int y, int width, int height)}
\Indextt{Redraw}

\code{Redraw} is called when the canvas needs to be redrawn.
The first redraw is generated when the canvas is first created.
Other redraws are generated when the canvas is covered or uncovered
by another window, and means the contents of the canvas must
be repainted. Normally, you will put a call to the code that
redraws your OpenGl picture here.

The parameters of \code{Redraw} represent the rectangular area
that needs to be repainted. This areas is not always the whole
canvas, and it is possible that many \code{Redraw} events will
be generated in a row as the user drags a covering window off
the canvas.

The default \code{Redraw} in \code{vBaseGLCanvasPane} is a
no-op, and your subclass needs to override \code{Redraw}.

%............................................................
\Meth{virtual void Resize(int newW, int newH)}
\Indextt{Resize}

A \code{Resize} event is generated when the user changes the
size of the canvas using the resize window command provided
by the host windowing system.

The default \code{Resize} in \code{vBaseGLCanvasPane} is a
no-op, and your subclass needs to override \code{Redraw}.

%............................................................
\Meth{virtual void VPage(int Shown, int Top)}
\Indextt{VPage}

See the description of \code{vCanvasPane} for details.

%............................................................
\Meth{virtual void VScroll(int step)}
\Indextt{VScroll}

See the description of \code{vCanvasPane} for details.

\subsection* {Specific OpenGL methods} %----------------------

%............................................................
\Meth{virtual void graphicsInit(void)}
\Indextt{graphicsInit}

This method is called after the OpenGL drawing canvas has
been created, and \emph{must} be overridden by your code.
You use this method to set up whatever you would usually do
to initialize OpenGL. In practice, this is a very convenient
way to get things started. 

It is critical that you call the \code{graphicsInit} method
in the base \code{vBaseGLCanvasPane} class \emph{first},
then whatever OpenGL calls you need.
See the example in the OpenGL tutorial section for more details.

%............................................................
\Meth{void vglMakeCurrent(void)}
\Indextt{vglMakeCurrent}

This method should be called by your program before you
call any OpenGL drawing code. Normally, this is called
first thing in \code{Redraw}, or whatever code you use
to draw with. It is essential to call this, and since
it is cheap to call this for an already current drawing
canvas, it is better to be safe.

%............................................................
\Meth{virtual void vglFlush(void)}
\Indextt{vglFlush}

Call this method after you are finished calling OpenGL to
draw a picture. It automatically handles the details of
displaying your picture in the window, including double
buffering and synchronization. It is normally found in your
\code{Redraw} method.
        
%............................................................
\Meth{virtual XVisualInfo* GetXVisualInfo()}
\Indextt{GetXVisualInfo()}

This method is specific to X, and will return a pointer to the
\code{XVisualInfo} structure currently being used. There will
be an equivalent method available for MS-Windows.

\subsection* {Tutorial} %---------------------------------------

A minimal V/OpenGL application will consist of a class derived
from \code{vApp}, a class derived from \code{vCmdWindow}, and
a canvas pane class derived from \code{vBaseGLCanvasPane}.
Most of your drawing code will be in or called from your derived
canvas pane.

Within that class, you will minimally need to override the
\code{graphicsInit} method, and the \code{Redraw} method. The
following code fragment, adapted directly from the example code
in Mark J. Kilgard's book, \emph{OpenGL, Programming for the X
Window System}, shows how simple it can be to draw a picture.
The full code can be found in the \code{opengl/shapes} directory
in the \V\ distribution.

\footnotesize
\begin{verbatim}

  static int initDone = 0;

  ......

//==========>>> testGLCanvasPane::graphicsInit <<<=================
  void testGLCanvasPane::graphicsInit(void)
  {
    // Always call the superclass first!
    vBaseGLCanvasPane::graphicsInit();

    // Example from Mark Kilgard
    glEnable(GL_DEPTH_TEST);
    glClearDepth(1.0);
    glClearColor(0.0, 0.0, 0.0, 0.0);  /* clear to black */
    glMatrixMode(GL_PROJECTION);
    gluPerspective(40.0, 1.0, 10.0, 200.0);
    glMatrixMode(GL_MODELVIEW);
    glTranslatef(0.0, 0.0, -50.0);
    glRotatef(-58.0, 0.0, 1.0, 0.0);

    initDone = 1;
  }

//============>>> testGLCanvasPane::Spin <<<=======================
  void testGLCanvasPane::Spin()
  {
    // Called from the parent CmdWindow for animation
    vglMakeCurrent();              // Call this FIRST!
    glRotatef(2.5, 1.0, 0.0, 0.0);
    Redraw(0,0,0,0);
  }

//============>>> testGLCanvasPane::Redraw <<<=====================
  void testGLCanvasPane::Redraw(int x, int y, int w, int h)
  {
    static int inRedraw = 0;

    if (inRedraw || !initDone)  // Don't draw until initialized
 	return;

    inRedraw = 1;               // Don't allow recursive redraws.

    vglMakeCurrent();           // Call this to make current

    // Code taken directly from Mark J. Kilgard's example
    // Draws 3 intersecting triangular planes
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glBegin(GL_POLYGON);
    glColor3f(0.0, 0.0, 0.0); glVertex3f(-10.0, -10.0, 0.0);
    glColor3f(0.7, 0.7, 0.7); glVertex3f(10.0, -10.0, 0.0);
    glColor3f(1.0, 1.0, 1.0); glVertex3f(-10.0, 10.0, 0.0);
    glEnd();

    glBegin(GL_POLYGON);
    glColor3f(1.0, 1.0, 0.0); glVertex3f(0.0, -10.0, -10.0);
    glColor3f(0.0, 1.0, 0.7); glVertex3f(0.0, -10.0, 10.0);
    glColor3f(0.0, 0.0, 1.0); glVertex3f(0.0, 5.0, -10.0);
    glEnd();

    glBegin(GL_POLYGON);
    glColor3f(1.0, 1.0, 0.0); glVertex3f(-10.0, 6.0, 4.0);
    glColor3f(1.0, 0.0, 1.0); glVertex3f(-10.0, 3.0, 4.0);
    glColor3f(0.0, 0.0, 1.0); glVertex3f(4.0, -9.0, -10.0);
    glColor3f(1.0, 0.0, 1.0); glVertex3f(4.0, -6.0, -10.0);
    glEnd();

    vglFlush();    // Call when done drawing to display

    inRedraw = 0;  // Not in here any more
  }

  ....
\end{verbatim}
\normalfont\normalsize

Note that this example includes a method called \code{Spin}.
It is used to animate the intersecting planes. In a \V\
OpenGL application, the easiest way to implement animation
is with the timer. Create a timer in the Command Window
class, and then call the animation code in the canvas
in response to timer events. You should keep code to
prevent recursive redraws if the timer events end up
occurring faster than the picture can be rendered, which
might happen for complex pictures or heavily loaded systems.
See the example code in the \code{v/opengl} directory for
a complete example of animation using the timer.

\subsection* {See Also} %---------------------------------------

vCanvasPane

%------------------------------------------------------------------------

\Class{vColor}
\Indextt{vColor}
\index{color!in V}

A class for handling and specifying colors.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vcolor.h>}
	\item [Class name:] vColor
\end{description}

\subsection* {Description}

The \V\ color model allows you to specify colors as an RGB value.
\index{color!RGB model}
The intensity of each primary color, red, green, and blue are
specified as a value between 0 and 255. This allows you to
specify up to $2^{24}$ colors. Just how many of all these
colors you can see and how they will look on your display will
depend on that display. Even so, you can probably count  on
(255,0,0) being something close to red on most displays. Given
this 24 bit model, the \code{vColor} class allows you to define
colors easily.

In order to make using colors somewhat easier, \V\ has defined
\index{color!standard}
a standard array of 16 basic colors that you can
access by including \code{v/vcolor.h>}. This array is called
\code{vStdColors}. You index the array using the symbols \code{vC\_Black},
\code{vC\_Red}, \code{vC\_DimRed}, \code{vC\_Green}, \code{vC\_DimGreen},
\code{vC\_Blue}, \code{vC\_DimBlue}, \code{vC\_Yellow},
\code{vC\_DimYellow}, \code{vC\_Magenta}, \code{vC\_DimMagenta},
\code{vC\_Cyan}, \code{vC\_DimCyan}, \code{vC\_DarkGray},
\code{vC\_MedGray}, and \code{vC\_White}. For example, use the standard color
\code{vStdColors[vC\_Green]} to represent green. You can also get a
\code{char} for the color by using the symbol to index the
\code{char* vColorName[16]} array.

The file \code{<v/vcb2x4.h>} contains definitions for
\index{color!selection buttons}
8 color buttons in a 2 high by 4 wide frame. The file
\code{<v/vcb2x8.h>} has a 2 by 8 frame of all 16 standard colors.
You can specify the size of each button in the frame by
defining \code{vC\_Size}. The default is 8. You can also specify
the location in a dialog of the color button frame by defining
the symbols \code{vC\_Frame, vC\_RightOf,} and \code{vC\_Below}.
The ids of each button in the frame correspond to the color
indexes, but with a \code{M} prefix (e.g., \code{M\_Red} for
\code{vC\_Red}). See the example in \code{v/examp} for and example
of using the standard color button frames.

Also note that unlike most other \V\ objects, it makes perfect
sense to assign and copy \code{vColor} values. Thus, assignment,
copy constructor, and equality comparison operators are provided.

\subsection* {Constructor} %------------------------------------

\Meth{vColor(unsigned int rd 0, unsigned int gr = 0, unsigned int
bl = 0)}
\Indextt{vColor}

The class has been defined so you can easily initialize a color
either by using its constructor directly, or indirectly via an
array declaration. Each color has a red, green, and blue value in
the range of 0 to 255.

\footnotesize
\begin{verbatim}
  // Declare Red via constructor
  vColor btncolor(255, 0 , 0);   // Red

  // Declare array with green and blue
  vColor GreenAndBlue[2] =
    {
      (0, 255, 0),              // Green
      (0, 0, 255)               // Blue
    };
\end{verbatim}
\normalfont\normalsize

\subsection* {Utility Methods} %--------------------------------

\Meth{BitsOfColor()}

This method returns the number of bits used by the machine
to display to represent color. A value of 8, for example,
means the computer is using 8 bits to show the color.

\Meth{ResetColor(unsigned int rd = 0, unsigned int gr = 0,
unsigned int bl = 0)}
\Meth{ResetColor(vColor\& c)}
\Indextt{ResetColor}

Like the \code{Set} method, this method will set all three values
of the color at once. However, \V\ tries to preserve entries in
the system color palette or color map with \code{ResetColor}.
You can also pass a \code{vColor} object.

Consider the following code excerpt:

\footnotesize
\begin{verbatim}
    vColor aColor;        // A V Color
    vBrush aBrush;
    int iy;

    ...

    for (iy = 0 ; iy < 128 ; ++iy)
      {
        aColor.Set(iy,iy,iy);     // Set to shade of gray
        aBrush.SetColor(aColor);  // Set brush
        canvas.DrawLine(10,iy+100,200,iy+100);  // Draw line
      }
    ...

\end{verbatim}
\normalfont\normalsize

This example will use up 128 color map entries on some systems
(X, for example). Once a system has run out of entries, \V\ will
draw in black or white. When these systems run out of new color
map entries, the color drawn for new colors will be black or
white. 

\footnotesize
\begin{verbatim}
    vColor aColor;        // A V Color
    vBrush aBrush;
    int iy;

    ...

    for (iy = 0 ; iy < 128 ; ++iy)
      {
        aColor.ResetColor(iy,iy,iy);     // Set to shade of gray
        aBrush.SetColor(aColor);  // Set brush
        canvas.DrawLine(10,iy+100,200,iy+100);  // Draw line
      }
    ...

\end{verbatim}
\normalfont\normalsize

This example accomplishes the same as the first, but does not use
up color map entries. Instead, the entry used for \code{aColor}
is reused to get better use of the color map. If your application
will be working with a large number of colors that will vary,
using \code{ResetColor} will minimize the number of color map accesses.

On some systems, and systems with a full 24 bits of color,
\code{ResetColor} and \code{Set} work identically.

\emph{WARNING}: If you intend to use \code{ResetColor} on a
\code{vColor} object, then \code{ResetColor} is the only way
you should change the color of that object. You should not
use the color assignment operator, or \code{Set}. \code{ResetColor}
needs to do some unconventional things internally to
preserve color palette entries, and these can be incompatible
with regular assignment or \code{Set}. You can, however,
safely use such a \code{vColor} object with any other \code{vColor}
object. For example:

\footnotesize
\begin{verbatim}
    vColor c1, c2;

    c1.ResetColor(100,100,100);    // You can use c1 with others.
    c2 = c1;                       // OK, but this = now makes c2
                                   // incompatible with ResetColor.
    c2.ResetColor(200,200,200);    // DON'T DO THIS
\end{verbatim}
\normalfont\normalsize

\Meth{Set(unsigned int rd = 0, unsigned int gr = 0, unsigned int bl = 0)}

Set all three values of the color at once.

\Meth{void SetR(unsigned int rd = 0)}
\Indextt{SetR}

Set the Red value.

\Meth{void SetG(unsigned int gr = 0)}
\Indextt{SetG}

Set the Green value.

\Meth{void SetB(unsigned int bl = 0)}
\Indextt{SetB}

Set the Blue value.

\Meth{unsigned int r()}

Get the Red value.

\Meth{unsigned int g()}

Get the Green value.

\Meth{unsigned int b()}

Get the Blue value.

\Meth{int operator ==}

Compare two color objects for equality.

\Meth{int operator !=}

Compare two color objects for inequality.

\subsection* {Notes about color}

The color model used by \V\ attempts to hide most of the
details for using color. However, for some applications
you may end up confronting some of the sticky issues of
color.

Most machines in use in 1996 will not support all $2^{24}$
colors that can be represented by the RGB color specification.
Typically, they devote 8 or 16 bits to each pixel. This
means that the 24-bit RGB colors must be mapped to the
smaller 8-bit or 16-bit range. This mapping is usually
accomplished by using a palette or colormap.

\V\ tries to use the default system color palette provided by the
machine it is running on. On some systems, such as X, it is
possible to run out of entries in the color map. Others, like
Windows, map colors not in the color palette to dithered colors.
\V\ provides two methods to help with this problem. First,
\code{vColor::BitsOfColor()} tells you how many bits are used by
the running system to represent color. The method  
\code{vColor::ResetColor(r,g,b)} can be used to change the value
of a color without using up another entry in the system color
map. For now, these methods should allow you to work with color
with pretty good flexibility. Eventually, \V\ may include more
direct support for color palettes.


\subsection* {See Also}

C\_ColorButton, vCanvas


%------------------------------------------------------------------------

\Class{vDC}
\Indextt{vDC}

This is the base class that defines all the drawing methods provided
by the various drawing canvases.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vdc.h>}
	\item [Class name:] vDC
\end{description}

\subsection* {Description}

All drawing classes such as \code{vCanvasPaneDC} and \code{vPostScriptDC}
are derived from this class. Each drawing class will support
these methods as needed. Not all drawing classes have the same
scale, and printer drawing canvases provide extra support for
paging. Your code will not normally need to include \code{vdc.h}.

See the specific sections for details of drawing classes.

\subsection* {Utility Methods}

%............................................................
\Meth{virtual void BeginPage()}
\Indextt{BeginPage}

Supported by printer canvases. Call to specify a page is
beginning. Bracket pages with \code{BeginPage} and \code{EndPage}
calls.

%............................................................
\Meth{virtual void BeginPrinting()}
\Indextt{BeginPrinting}

Required by printer canvases. Call to specify a document is
beginning. You \emph{must} bracket documents with \code{BeginPrinting}
and \code{EndPrinting} calls. \code{BeginPrinting} includes an
implicit call to \code{BeginPage}.

%............................................................
\Meth{virtual void Clear()}
\Indextt{Clear}

Clear the canvas to the background color. No op on printers.

%............................................................
\Meth{virtual void ClearRect(int x, int y, int width, int height)}
\Indextt{ClearRect}

Clear a rectangular area starting at x,y of height and width. No
op on printers.

%............................................................
\Meth{void CopyFromMemoryDC(vMemoryDC* memDC, int destX, int
destY, int srcX = 0, int srcY = 0, int srcW = 0, int srcH = 0)}
\Indextt{CopyFromMemoryDC}
 
This method is used to copy the image contained in a \code{vMemoryDC}
to another drawing canvas. The parameter \code{memDC} specifies
the \code{vMemoryDC} object, and \code{destX} and \code{destY}
specify where the image is to be copied into \code{this} drawing
canvas (which will usually be 0,0). If you use the default
values for \code{srcX=0}, \code{srcY=0}, \code{srcW=0}, and
\code{srcH=0}, the entire source canvas will be copied.

Beginning with \V release 1.13, \code{CopyFromMemoryDC} provides
the extra parameters to specify an area of the source to copy.
You can specify the source origin, and its width and height.
The default values for these allow backward call and behavior
compatibility.

One of the most useful uses of this is to draw both the canvas
pane drawing canvas, and to a memory drawing canvas, and then
use \code{CopyFromMemoryDC} to copy the memory canvas to the
canvas pane for \code{Redraw} events.

%............................................................
\Meth{virtual void DrawAttrText(int x, int y, char* text, const
ChrAttr attr)}
\Indextt{DrawAttrText}

Draw text using the current font with specified attributes at
given x, y.

\index{text drawing attributes}
\code{ChrAttr attr} is used to specify attributes to override
some of the text drawing characteristics normally determined by
the pen and font. Specifying \code{ChNormal} means the current
pen and font will be used.  \code{ChReverse} is used to specify
the text should be drawn reversed or highlighted, using the
current font and pen. You can also specify 16 different standard
colors to override the pen color. You use \code{ORed}
combinations the basic color attributes \code{ChRed}, \code{ChBlue},
and \code{ChGreen}. Most combinations are also provided as
\code{ChYellow}, \code{ChCyan}, \code{ChMagenta},  \code{ChWhite},
and \code{ChGray}. These colors can be combined with \code{ChDimColor}
can be used for half bright color combinations (or you can use
\code{ChDimRed}, etc.). You can combine color attributes with
\code{ChReverse}. Attributes such as boldface, size, and
underlining are attributes of the font.

%............................................................
\Meth{virtual void DrawColorPoints(int x, int y, int nPts, vColor*
pts)}
\Indextt{DrawColorPoints}

Draw an array of \code{nPts} \code{vColors} as points starting at
x,y. This method is useful for drawing graphical images, and
bypasses the need to set the pen or brush for each point.
Typically, \code{DrawColorPoints} will be significantly faster
than separate calls to \code{DrawPoint}.

%............................................................
\Meth{virtual void DrawEllipse(int x, int y, int width, int
height)}
\Indextt{DrawEllipse}

Draw an ellipse inside the bounding box specified by x, y, width,
and height.
The current Pen will be used to draw the shape, and the current
Brush will be used to fill the shape.

%............................................................
\Meth{virtual void DrawIcon(int x, int y, vIcon\& icon)}
\Indextt{DrawIcon}

A \code{vIcon} is drawn at x,y using the current Pen.
Note that only the location of an icon is scaled. The icon
will retain its original size.

%............................................................
\Meth{virtual void DrawLine(int x, int y, int xend, int yend)}
\Indextt{DrawLine}

Draw a line from x,y to xend,yend.
The current Pen will be used to draw the line.

%............................................................
\Meth{virtual void DrawLines(vLine* lineList, int count)}
\Indextt{DrawLines}

Draws the \code{count} lines contained in the list \code{lineList}.

The current Pen will be used to draw the lines.

The type \code{vLine} is defined in \code{v\_defs.h} as:
\Indextt{vLine}
\footnotesize
\begin{verbatim}
    typedef struct vLine
      {
        short x, y, xend, yend;
      } vLine;
\end{verbatim}
\normalfont\normalsize


%............................................................
\Meth{virtual void DrawPoint(int x, int y)}
\Indextt{DrawPoint}

Draw a point at x,y using the current Pen.

%............................................................
\Meth{virtual void DrawPoints(vPoint* pointList, int count)}
\Indextt{DrawLines}

Draws the \code{count} points contained in the list \code{pointList}.

The current Pen will be used to draw the points.

The type \code{vPoint} is defined in \code{v\_defs.h} as:
\Indextt{vLine}
\footnotesize
\begin{verbatim}
    typedef struct vPoint
      {
        short x, y;
      } vPoint;
\end{verbatim}
\normalfont\normalsize

%............................................................
\Meth{virtual void DrawPolygon(int n, vPoint points[],
int fillMode = vAlternate)}
\Indextt{DrawPolygon}

A closed polygon of n points is drawn. Note that the
first and last element of the point list must specify
the same point.
The current Pen will be used to draw the shape, and the current
Brush will be used to fill the shape.

The fillMode parameter specifies one of two alternative filling
algorithms, \code{vAlternate} or \code{vWinding}. These algorithms correspond
to the equivalent algorithms on the native platforms.

The type \code{vPoint} is defined in \code{v\_defs.h} as:
\Indextt{vPoint}
\footnotesize
\begin{verbatim}
    typedef struct vPoint       // a point
      {
        short x, y;             // X version
      } vPoint; 
\end{verbatim}
\normalfont\normalsize

%............................................................
\Meth{virtual void DrawRoundedRectangle(int x, int y, int width,
int height, int radius = 10)}
\Indextt{DrawRoundedRectangle}

Draw a rectangle with rounded corners at x,y of size width and
height. The radius specifies the radius of the circle used to
draw the corners. If a radius of less than 0 is specified, the
radius of the corners will be ((width+height)/-2*radius) which
gives a more or less reasonable look for various sized
rectangles. The current Pen will be used to draw the shape, and
the current Brush will be used to fill the shape.

%............................................................
\Meth{virtual void DrawRectangle(int x, int y, int width,
int height)}
\Indextt{DrawRectangle}

Draw a rectangle with square corners at x,y of size width and
height. The current Pen will be used to draw the shape, and the
current Brush will be used to fill the shape.

%............................................................
\Meth{virtual void DrawRectangles(vRect* rectList, int count)}
\Indextt{DrawRectangles}

Draw a list of \code{count} \code{vRect} rectangles pointed to by
the list \code{rectList}.
The current Pen will be used to draw the rectangles, and the
current Brush will be used to fill the rectangles.

The type \code{vRect} is defined in \code{v\_defs.h} as:
\Indextt{vRect}
\footnotesize
\begin{verbatim}
    typedef struct vRect
      {
        short x, y, w, h;
      } vRect;
\end{verbatim}
\normalfont\normalsize

%............................................................
\Meth{virtual void DrawRubberLine(int x, int y, int xend, int yend)}
\Indextt{DrawRubberLine}

Draw a rubber-band line from x, y to xend, yend. This method is most
useful for showing lines while the mouse is down. By first drawing
a rubber line, and then redrawing over the same line with \code{DrawRubberLine}
causes the line to be erased. Thus, pairs of rubber lines can track
mouse movement. The current Pen is used to determine line style.

%............................................................
\Meth{virtual void DrawRubberEllipse(int x, int y, int width,
int height)}
\Indextt{DrawRubberEllipse}

Draw a rubber-band Ellipse. See DrawRubberLine.

%............................................................
\Meth{virtual void DrawRubberPoint(int x, int y)}
\Indextt{DrawRubberPoint}

Draw a rubber-band point. See DrawRubberLine.

%............................................................
\Meth{virtual void DrawRubberRectangle(int x, int y, int width,
int height)}
\Indextt{DrawRubberRectangle}

Draw a rubber-band rectangle. See DrawRubberLine.

%............................................................
\Meth{virtual void DrawText(int x, int y, char* text)}
\Indextt{DrawText}

Simple draw text at given x, y using the current font and
current pen. Unlike icons and other \V\ drawing objects,
\code{x} and \code{y} represent the lower left corner of the
first letter of the text. Using a \code{vSolid} pen results
in the text being drawn in with the pen's color using
the current background color. Using a \code{vTransparent}
pen results in text in the current color, but just drawing
the text over the current canvas colors. (See \code{vPen::SetStyle}.)

%............................................................

\Meth{virtual void EndPage()}
\Indextt{EndPage}

Supported by printer canvases. Call to specify a page is
ending. Bracket pages with \code{BeginPage} and \code{EndPage}
calls.

%............................................................
\Meth{virtual void EndPrinting()}
\Indextt{EndPrinting}

Supported by printer canvases. Call to specify a document is
ending. Bracket documents with \code{BeginPrinting} and
\code{EndPrinting} calls. \code{EndPrinting} includes
an implicit call to \code{EndPage}.

%............................................................
\Meth{virtual vBrush GetBrush()}
\Indextt{GetBrush}

Returns a copy of the current brush being used by the canvas.

%............................................................
\Meth{virtual vFont GetFont()}
\Indextt{GetFont}

Returns a copy of the current font of the drawing canvas.

%............................................................
\Meth{virtual vBrush GetPen()}
\Indextt{GetPen}

Returns a copy of the current pen being used by the canvas.

%............................................................
\Meth{virtual int GetPhysHeight()}
\Indextt{GetPhysHeight}

Returns the maximum physical y value supported by the
drawing canvas. Especially useful for determining scaling
for printers.

%............................................................
\Meth{virtual int GetPhysWidth()}
\Indextt{GetPhysWidth}

Returns the maximum physical x value supported by the
drawing canvas. Especially useful for determining scaling
for printers.

%............................................................
\Meth{virtual void GetScale(int\& mult, int\& div)}
\Indextt{GetScale}

Returns the scaling factors for the
canvas. See \code{SetScale}.

%............................................................
\Meth{void GetTranslate(int\& x, int\& y)}
\Indextt{GetTranslate}
\Meth{int GetTransX()}
\Indextt{GetTransX}
\Meth{int GetTransY()}
\Indextt{GetTransY}

Returns the current x and y translation values.

%............................................................
\Meth{virtual void SetBackground(vColor\& color)}
\Indextt{SetBackground}
\index{color!background}

This sets the background of the drawing canvas to the
specified color.

%............................................................
\Meth{virtual void SetBrush(vBrush\& brush)}
\Indextt{SetBrush}

This sets the brush used by the drawing canvas. Brushes are used
for the filling methods such as \code{vDrawPolygon}. It is
important to call \code{SetBrush} whenever you change any
attributes of a brush used by a drawing canvas.

%............................................................
\Meth{virtual void SetFont(vFont\& vf)}
\Indextt{SetFont}

Change the font associated with this canvas. The default method
handles changing the font and calls the FontChanged method for
the canvas pane.

%............................................................
\Meth{virtual void SetPen(vPen\& pen)}
\Indextt{SetPen}

Sets the current pen of the canvas to pen. Pens are used
to draw lines and the outlines of shapes. It is important
to call \code{SetPen} whenever you change any attributes of
a pen used by a drawing canvas.

%............................................................
\Meth{virtual void SetScale(int mult, int div)}
\Indextt{SetScale}

Sets the scaling factor. Each coordinate passed to the 
drawing canvas is first multiplied by mult and then divided
by div. Thus, to scale by one third, set mult to 1 and div to 3.
Many applications will never have to worry about scaling.
Note that scaling applies to output only. The mouse
events will provide unscaled coordinates, and it is up
to your code to scale mouse coordinates appropriately.

%............................................................
\Meth{void SetTranslate(int x, int y)}
\Indextt{SetTranslate}
\Meth{void SetTransX(int x)}
\Indextt{SetTransX}
\Meth{void SetTransY(int y)}
\Indextt{SetTransY}

These methods set the internal translation used by the
drawing canvas. Each coordinate sent to the various
drawing methods (e.g., \code{DrawRectangle}) will be
translated by these coordinates. This can be most useful
when using the scroll bars to change which part of a
drawing is visible on the canvas. Your application will
have to handle proper mapping of mouse coordinates.

%............................................................
\Meth{int TextHeight(int\& ascent, int\& descent)}
\Indextt{TextHeight}

This function returns the total height of the font \code{fontId}.
The total height of the font is the sum of the \code{ascent} and
\code{descent} heights of the font \code{fontId}. Each character
ascends \code{ascent} pixels above the Y coordinate where it is
being drawn, and \code{descent} pixels below the Y coordinate.

%............................................................
\Meth{int TextWidth(char* str)}
\Indextt{TextWidth}

Returns the width in pixels or drawing points of the string
\code{str} using the currently set font of the canvas.

%------------------------------------------------------------------------
\Class{vMemoryDC}
\Indextt{vMemoryDC}

A memory drawing canvas.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vmemdc.h>}
	\item [Class name:] vMemoryDC
\end{description}

\subsection* {Description}

This drawing canvas can be used to draw to memory. Like
all drawing canvases, the available methods are described
in \code{vDC}. A very effective technique for using a memory
canvas is to draw to both the screen canvas pane and a memory
canvas during interactive drawing, and use the memory canvas to
update the screen for \code{Redraw} events. This is especially
useful if your application requires extensive computation to
draw a screen.

\subsection* {Methods}

\Meth{vMemoryDC(int width, int height)}
\Indextt{vMemoryDC}

The constructor is used to construct a memory DC of the
specified width and height. This can be anything you need.
If you are using the memory DC to update the screen for
\code{Redraw} events, then it should be initialized to be
big enough to repaint whatever you will be drawing on the
physical screen. The methods  \code{vApp::ScreenWidth()} and
\code{vApp::ScreenHeight()} can be used to obtain the maximum
size of the physical screen.

The method \code{CopyFromMemoryDC} is used to copy the contents
of a memory DC to another DC. This can be another memory DC, but
will usually be a canvas pane DC.

%------------------------------------------------------------------------
\Class{vPen}
\Indextt{vPen}\index{pen}

A class to specify the pen used to draw lines and shapes.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vpen.h>}
	\item [Class name:] vPen
\end{description}

\subsection* {Description}

Pens are used to draw lines and the outlines of shapes. Pens have
several attributes, including color, width, and style.

\subsection* {Methods}

\Meth{vPen(unsigned int r = 0, unsigned int g = 0, unsigned int b = 0, 
int width = 1, int style = vSolid)}
\Indextt{vPen}

The constructor for a pen allows you to specify the pen's color,
width, and style. The default will construct a solid black pen of
width 1.

\Meth{int operator ==, !=}

You can use the operators \code{==} and \code{!=} for comparisons.

\Meth{vColor GetColor()}
\Indextt{GetColor}

This method returns the current color of the pen as a \code{vColor} object.

\Meth{int GetStyle()}
\Indextt{GetStyle}

This method returns the current style of the pen.

\Meth{void GetWidth()}
\Indextt{GetWidth}

This gets the width of the line the pen will draw.

\Meth{void SetColor(vColor\& c)}
\Indextt{SetColor}
\index{color!pen}

You can use this method to set the pen color by passing
in a \code{vColor} object.

\Meth{void SetStyle(int style)}
\Indextt{SetStyle}

This method is used to change the style of a pen. Styles include:

\begin{description}
	\item [vSolid] The pen draws a solid line.
	\item [vTransparent] The pen is transparent. A transparent
pen can be used to avoid drawing borders around shapes. When drawing
text, a transparent pen draws the text over the existing background.
	\item [vDash] The pen draws a dashed line.
	\item [vDot] The pen draws a dotted line.
	\item [vDashDot] The pen draws an alternating dash and dotted line.
\end{description}

\Meth{void SetWidth(int width)}
\Indextt{SetWidth}

This sets the width of the line the pen will draw.

%------------------------------------------------------------------------
\Class{vPrintDC}
\Indextt{vPrintDC}\index{printing}

A printer drawing canvas.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vprintdc.h>}
	\item [Class name:] vPrintDC
\end{description}

\subsection* {Description}

This drawing canvas can be used to draw to a printer. Like
all drawing canvases, the available methods are described
in \code{vDC}. A very effective technique for combining a printer
DC and a screen DC is to pass a pointer to either a \code{vCanvasPaneDC}
or a \code{vPrintDC} to the code that draws the screen. The same
code can then be used to draw or print.

To successfully use a \code{vPrintDC}, your code must
obtain the physical size of the page in units using
\code{GetPhysWidth} and \code{GetPhysHeight}. On
paper, these represent 1/72 inch points, and correspond
very closely, but not exactly, to a pixel on the screen.

You must bracket the printing with calls to \code{BeginPrinting}
and \code{EndPrinting}. Use \code{BeginPage} and \code{EndPage}
to control paging. Note that the width of text will not
necessarily be the same on a \code{vCanvasPaneDC} and a \code{vPrintDC},
even for the same fonts. Also, the size of the paper represents
the entire page. Most printers cannot actually print all the way
to the edges of the paper, so you will usually use \code{vDC:SetTranslate}
to leave some margins. (Don't forget to account for margins when
you calculate what can fit on a page.)

The implementation of \code{vPrintDC} is somewhat platform
dependent. For X, \code{vPrintDC} represents a PostScript
printer, and is derived from the class \code{vPSPrintDC}. For
Windows, \code{vPrintDC} is derived from the \code{vWinPrintDC}
class. To get platform independent operation for your
application, use \code{vPrintDC}. On Windows, you can also use
the PostScript version directly if you want by using the \code{vPSPrintDC}
class, but the program will not conform to standard Windows
behavior.

\subsection* {Methods}

\Meth{void SetPrinter(vPrinter\& printer)}
\Indextt{SetPrinter}

This method is used to associate a \code{vPrinter} with
a \code{vPrintDC}.
By default, a \code{vPrintDC} represents standard
8.5x11 inch Letter paper printed in black and white in
portrait orientation. You can use \code{vPrinter::Setup} to allow
the user to change the attributes of the printer, then use
\code{SetPrinter} to associate those attributes with the \code{vPrintDC}.
Note: If you change the default printer attributes, you \emph{must}
call \code{SetPrinter} before doing any drawing to the DC.

\subsection* {Example}

This is a simple example taken from the \code{VDraw} demo program.
\code{Print} is called to print the current drawing. \code{Print}
calls \code{vPrinter::Setup} to set the printer characteristics,
and then calls \code{DrawShapes} with a pointer to the \code{vPrintDC}.
\code{DrawShapes} is also called to repaint the screen using the
\code{vCanvasPaneDC}. By carefully planning for both screen and
printer drawing, your program can often share drawing code in
this fashion.

\footnotesize
\begin{verbatim}
//===================>>> myCanvasPane::Print <<<=================
  void myCanvasPane::Print()
  {
    // Print current picture

    vPrintDC pdc;               // create a vPrintDC object
    vPrinter printer;           // and a printer to set attributes

    printer.Setup("test.ps");   // setup the printer
    pdc.SetPrinter(printer);    // change to the printer we setup

    if (!pdc.BeginPrinting())   // call BeginPrinting first
        return;

    pdc.SetTranslate(36,36);    // Add 1/2" (36 * 1/72") margins

    DrawShapes(&pdc);           // Now, call shared drawing method

    pdc.EndPrinting();          // Finish printing
  }

//===================>>> myCanvasPane::DrawShapes <<<=================
  void myCanvasPane::DrawShapes(vDC* cp)
  {
    // Common code for drawing both on Screen and Printer
    ...
  }
\end{verbatim}
\normalfont\normalsize

%------------------------------------------------------------------------
\Class{vPrinter}
\Indextt{vPrinter}\index{printer attributes}

A printer object, with a dialog to interactively set printer
attributes.

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vprinter.h>}
	\item [Class name:] vPrinter
\end{description}

\subsection* {Description}

The \code{vPrintDC} class prints to a printer (or a file that
will eventually be printed). Printers have such attributes as
size of paper, page orientation, color capability, etc. By
calling the \code{vPrinter::Setup} dialog before printing, the
user will be given the option of setting various printer
attributes.

The exact functionality of the \code{Setup} dialog will be
platform dependent. By using the \code{vPrinter} class, you will
get the behavior appropriate for the platform. If you want to use
the \code{vPSPrintDC} class for PostScript support on Windows,
you can use \code{vPSPrinter} directly.

You can use the various methods associated with a \code{vPrinter}
to get printer attributes as needed to during drawing to
the \code{vPrintDC}.

\subsection* {Methods}

\Meth{int GetCopies()}
\Indextt{GetCopies}

\Meth{void SetCopies(int s)}
\Indextt{SetCopies}

Many printers support printing multiple copies of the same
document. This attributes controls the number of copies printed.
The \code{Setup} dialog will provide control of this \emph{if} it
is supported.

\Meth{char* GetDocName()}
\Indextt{GetDocName}

Printer output may be directed to a file rather than the printer.
If it is, this will return the name of the file the output will
be sent to.

\Meth{int GetPaper()}
\Indextt{GetPaper}

\Meth{char* GetPaperName()}
\Indextt{GetPaperName}

Printers can print a variety of papers. The user may be
able to select which paper from the \code{Setup} dialog.
The printers supported are defined in the \code{vprinter.h}
header file (or the base class used by \code{vPrinter}).

\Meth{int GetPortrait()}
\Indextt{GetPortrait}

\Meth{void SetPortrait(int p)}
\Indextt{SetPortrait}

Many printers can print in either Portrait or Landscape orientation.
This returns true if the printer will print in portrait.

\Meth{int GetToFile()}
\Indextt{GetToFile}

\Meth{void SetToFile(int f)}

Printer output may be directed to a file rather than the printer.
This returns true if the user selected the option to send output
to a file.

\Meth{int GetUseColors()}
\Indextt{GetUseColors}

\Meth{void SetUseColors(int c)}
\Indextt{SetUseColors}

Printers can be either black and white, or color. This
returns true if the printer supports colors. You can
make a color printer print black and white by setting
this to false.

\Meth{int Setup(char* fn = 0)}
\Indextt{Setup}

This displays a modal dialog for the user to select desired
printer characteristics. If a filename is supplied, that
name will be used if the user selects print to file.
If \code{Setup} returns false, you should abandon the
print job. After you call \code{Setup}, you can then
call \code{vPrintDC::SetPrinter} to associate the printer
with the \code{vPrintDC}.

\subsection* {Example}

See \code{vPrintDC} for an example of using \code{vPrinter::Setup}.

%-----------------------------------------------------------------
\Class{vTextCanvasPane}
\Indextt{vTextCanvasPane}

A class for drawing text on a canvas. 

\subsection* {Synopsis}

\begin{description}
	\item [Header:] \code{<v/vtextcnv.h>}
	\item [Class name:] vTextCanvasPane
 	\item [Hierarchy:] vPane \rta vCanvasPane \rta vTextCanvasPane
\end{description}

\subsection* {Description}

This class provides a complete scrolling text window. You
can send text line by line to the window, and it will scroll the
text up the screen in response to linefeed characters. You can
also position the cursor, and selectively clear areas of the text
screen or display text at specific locations. This class handles
repainting the screen on \code{Redraw} events. In essence, the
\code{vTextCanvasPane} class provides the functionality of a
typical simple-minded text terminal.

\subsection* {New Methods}

%............................................................
\Meth{void ClearRow(const int row, const int col)}
\Indextt{ClearRow}

This clears to blanks row \code{row} of the screen from
column \code{col} to the end of the line.

%............................................................
\Meth{void ClearToEnd(const int row, const int col)}
\Indextt{ClearToEnd}

This clears to blanks from row \code{row} and column \code{col}
to the end of the screen.

%............................................................
\Meth{int GetCols()}
\Indextt{GetCols}

Returns number of columns in current text canvas.

%............................................................
\Meth{int GetRows()}
\Indextt{GetRows}

Returns number of rows in current text canvas.

%............................................................
\Meth{void GetRC(int\& row, int\& col)}
\Indextt{GetRC}

Returns in \code{row} and \code{col} the current row and
column of the text cursor.

%............................................................
\Meth{void GotoRC(const int row ,const int row)}
\Indextt{GotoRC}

Moves the text cursor to \code{row,col}.

%............................................................
\Meth{void DrawAttrText(const char* text, const ChrAttr attr)}
\Indextt{DrawAttrText}

Draws \code{text} starting at the current cursor location using
text attribute \code{attr}. For more details, see \code{vDC::DrawAttrText}.

%............................................................
\Meth{void DrawChar(const char chr, const ChrAttr attr)}
\Indextt{DrawChar}

Draws a single character \code{chr} at the current
cursor location using text attribute \code{attr}. See
\code{DrawAttrText} for more details.

%............................................................
\Meth{void DrawText(const char* text)}
\Indextt{DrawText}

Draws \code{text} starting at the current cursor location.
The newline character \code{'$\backslash$n'} will
cause the cursor to move to the beginning of the next line,
and the text to scroll if the cursor was on the last line.

%............................................................
\Meth{void HideTextCursor(void)}
\Indextt{HideTextCursor}

This method will hide the text cursor.

%............................................................
\Meth{void ShowTextCursor(void)}
\Indextt{ShowTextCursor}

This method will redisplay the text cursor at the current
row and column.

%............................................................
\Meth{void ScrollText(const int count)}
\Indextt{ScrollText}

This will scroll the text in the text canvas up or down by
\code{count} lines.  There will be \code{count} blank lines
created at the bottom or top of the screen.

%............................................................
\Meth{void ResizeText(const int rows, const int cols)}
\Indextt{ResizeText}

This method handles resize events. You will want to override
this to track the new number of rows and columns.

%............................................................
\Meth{void TextMouseDown(int row, int col, int button)}
\Indextt{TextMouseDown}

This is called when the user clicks the mouse button down.
It is called with the text row and column, and the button number.

%............................................................
\Meth{void TextMouseUp(int row, int col, int button)}
\Indextt{TextMouseUp}

This is called when the user releases the mouse button.
It is called with the text row and column, and the button number.

%............................................................
\Meth{void TextMouseMove(int row, int col, int button)}
\Indextt{TextMouseMove}

This is called when the mouse moves.
It is called with the text row and column, and the button number.


\subsection* {Derived Methods}	

%............................................................
\Meth{virtual void Clear()}
\Indextt{Clear}

This clears the text canvas and resets the row and column
to 0,0.

%............................................................
\Meth{void FontChanged(int)}
\Indextt{FontChanged}

This is called when the font of the canvas changes.
\code{FontChanged} calls \code{ResizeText}, so you probably
won't have to deal with this event.

%............................................................
\Meth{void Redraw(int x, int y, int width, int height)}
\Indextt{Redraw}

Called when the screen needs to be redrawn. Normally, you won't
have to override this class since the \code{vTextCanvasPane}
superclass will handle redrawing what is in the window. Instead,
you will usually just have to respond to the \code{FontChanged}
and \code{ResizeText} events when the contents of the canvas will
actually change.

\subsection* {Inherited Methods}	%....................

\Meth{virtual void HPage(int Shown, int Top)}
\Indextt{HPage}

\Meth{virtual void HScroll(int step)}
\Indextt{HScroll}

\Meth{virtual void SetFont(int vf)}
\Indextt{SetFont}

\Meth{virtual void SetHScroll(int Shown, int Top)}
\Indextt{SetHScroll}

\Meth{virtual void SetVScroll(int Shown, int Top)}
\Indextt{SetVScroll}

\Meth{virtual void VPage(int Shown, int Top)}
\Indextt{VPage}

\Meth{virtual void VScroll(int step)}
\Indextt{VScroll}

\subsection* {See Also}

vCanvasPane, vWindow