875057783a1bd5770ba270a731c27c44438ccd25
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
33 extern HWND hWndDlgStats
;
35 BOOL CALLBACK
StatsDlgProc( HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
44 hWndListBox
= CreateWindow(
45 TEXT("LISTBOX"), // pointer to registered class name
46 TEXT("Listbox"), // pointer to window name
47 WS_CHILD
| WS_VISIBLE
| WS_VSCROLL
| WS_BORDER
| LBS_NOINTEGRALHEIGHT
, // window style
48 6, // horizontal position of window
49 6, // vertical position of window
52 hDlg
, // handle to parent or owner window
53 NULL
, // handle to menu or child-window identifier
54 NULL
, // handle to application instance
55 NULL
// pointer to window-creation data
58 ShowWindow(hWndListBox
, SW_SHOW
);
60 SendMessage (hWndListBox
, WM_SETFONT
, (UINT
)GetStockObject(DEFAULT_GUI_FONT
), TRUE
);
62 // SetFocus(hWndDlgStats);
67 switch( LOWORD( wParam
) ) {
70 SetFocus(GetParent(hDlg
));
77 i
= SendMessage(hWndListBox
, LB_GETCURSEL
, 0, 0);
78 SendMessage(hWndListBox
, LB_GETTEXT
, i
, (LPARAM
)calc
.buffer
);
79 calc_buffer_display(&calc
);
87 i
= SendMessage(hWndListBox
, LB_GETCURSEL
, 0, 0);
88 SendMessage(hWndListBox
, LB_DELETESTRING
, i
, 0);
89 InvalidateRect(hDlg
,NULL
,TRUE
);
95 SendMessage(hWndListBox
, LB_RESETCONTENT
, 0, 0);
96 InvalidateRect(hDlg
,NULL
,TRUE
);
104 TCHAR s
[CALC_BUF_SIZE
];
109 hdc
= BeginPaint( hDlg
, &ps
);
110 hFont
= GetStockObject(DEFAULT_GUI_FONT
);
111 hFontOrg
= SelectObject(hdc
, hFont
);
113 lb_count
= SendMessage(hWndListBox
, LB_GETCOUNT
, 0, 0);
114 _stprintf(s
, TEXT("n=%d"), lb_count
);
116 SetBkMode(hdc
, TRANSPARENT
);
117 TextOut(hdc
, 98, 121, s
, _tcslen(s
));
118 SelectObject(hdc
, hFontOrg
);
119 EndPaint( hDlg
, &ps
);
124 hWndDlgStats
= 0; // invalidate stats dialog
125 SendMessage(GetParent(hDlg
), WM_CHAR
, TEXT('\x13'), 1); // disable stats related calculator buttons
126 DestroyWindow( hDlg
);