4 * Copyright 2003 James Briggs
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <stdio.h> // sprintf
32 extern HWND hWndDlgStats
;
34 BOOL CALLBACK
StatsDlgProc( HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
43 hWndListBox
= CreateWindow(
44 "LISTBOX", // pointer to registered class name
45 "Listbox", // pointer to window name
46 WS_CHILD
| WS_VISIBLE
| WS_VSCROLL
| WS_BORDER
| LBS_NOINTEGRALHEIGHT
, // window style
47 6, // horizontal position of window
48 6, // vertical position of window
51 hDlg
, // handle to parent or owner window
52 NULL
, // handle to menu or child-window identifier
53 NULL
, // handle to application instance
54 NULL
// pointer to window-creation data
57 ShowWindow(hWndListBox
, SW_SHOW
);
59 SendMessage (hWndListBox
, WM_SETFONT
, (UINT
)GetStockObject(DEFAULT_GUI_FONT
), TRUE
);
61 // SetFocus(hWndDlgStats);
66 switch( LOWORD( wParam
) ) {
69 SetFocus(GetParent(hDlg
));
76 i
= SendMessage(hWndListBox
, LB_GETCURSEL
, 0, 0);
77 SendMessage(hWndListBox
, LB_GETTEXT
, i
, (LPARAM
)calc
.buffer
);
78 calc_buffer_display(&calc
);
86 i
= SendMessage(hWndListBox
, LB_GETCURSEL
, 0, 0);
87 SendMessage(hWndListBox
, LB_DELETESTRING
, i
, 0);
88 InvalidateRect(hDlg
,NULL
,TRUE
);
94 SendMessage(hWndListBox
, LB_RESETCONTENT
, 0, 0);
95 InvalidateRect(hDlg
,NULL
,TRUE
);
103 char s
[CALC_BUF_SIZE
];
108 hdc
= BeginPaint( hDlg
, &ps
);
109 hFont
= GetStockObject(DEFAULT_GUI_FONT
);
110 hFontOrg
= SelectObject(hdc
, hFont
);
112 lb_count
= SendMessage(hWndListBox
, LB_GETCOUNT
, 0, 0);
113 sprintf(s
, "n=%d", lb_count
);
115 SetBkMode(hdc
, TRANSPARENT
);
116 TextOut(hdc
, 98, 121, s
, strlen(s
));
117 SelectObject(hdc
, hFontOrg
);
118 EndPaint( hDlg
, &ps
);
123 hWndDlgStats
= 0; // invalidate stats dialog
124 SendMessage(GetParent(hDlg
), WM_CHAR
, '\x13', 1); // disable stats related calculator buttons
125 DestroyWindow( hDlg
);