1 /* ------------ barchart.c ----------- */
10 /* ------- project schedule array ------- */
11 static struct ProjChart
{
23 static char *Title
= " PROJECT SCHEDULE";
24 static char *Months
= " Jan Feb Mar Apr May Jun";
26 static int BarChartProc(DFWINDOW wnd
, DFMESSAGE msg
,
27 DF_PARAM p1
, DF_PARAM p2
)
31 if ((int)p1
== DF_ID_HELP
) {
32 DfDisplayHelp(wnd
, "BarChart");
36 case DFM_CLOSE_WINDOW
:
42 return DfDefaultWndProc(wnd
, msg
, p1
, p2
);
45 void BarChart(DFWINDOW pwnd
)
47 int pct
= sizeof projs
/ sizeof(struct ProjChart
);
51 Bwnd
= DfDfCreateWindow(DF_PICTUREBOX
,
53 -1, -1, BCHEIGHT
, BCWIDTH
,
54 NULL
, pwnd
, BarChartProc
,
60 DfSendMessage(Bwnd
, DFM_ADDTEXT
, (DF_PARAM
) Title
, 0);
61 DfSendMessage(Bwnd
, DFM_ADDTEXT
, (DF_PARAM
) "", 0);
62 for (i
= 0; i
< pct
; i
++) {
63 DfSendMessage(Bwnd
,DFM_ADDTEXT
,(DF_PARAM
)projs
[i
].prj
,0);
64 DfDrawBar(Bwnd
, DF_SOLIDBAR
+(i
%4),
65 11+projs
[i
].start
*COLWIDTH
, 2+i
,
66 (1 + projs
[i
].stop
-projs
[i
].start
) * COLWIDTH
,
69 DfSendMessage(Bwnd
, DFM_ADDTEXT
, (DF_PARAM
) "", 0);
70 DfSendMessage(Bwnd
, DFM_ADDTEXT
, (DF_PARAM
) Months
, 0);
71 DfDrawBox(Bwnd
, 10, 1, pct
+2, 25);
73 DfSendMessage(Bwnd
, DFM_SETFOCUS
, TRUE
, 0);