From: <kr_...@us...> - 2003-03-27 13:36:26
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv10752/port/src/cbits/Win32 Modified Files: Window.c Added Files: ProgressBar.c Slider.c Log Message: Added implementation for ProgressBar and Slider controls --- NEW FILE: ProgressBar.c --- #include "ProgressBar.h" #include "Internals.h" #include "Handlers_stub.h" WindowHandle osCreateHorzProgressBar(WindowHandle form, BOOL bSmooth) { HWND hBar; hBar = CreateWindow( PROGRESS_CLASS, NULL, (bSmooth ? PBS_SMOOTH : 0) | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0,0,0,0, form, NULL, ghModule, NULL ); return checkWindow(hBar, PROGRESS_CLASS); }; WindowHandle osCreateVertProgressBar(WindowHandle form, BOOL bSmooth) { HWND hBar; hBar = CreateWindow( PROGRESS_CLASS, NULL, (bSmooth ? PBS_SMOOTH : 0) | PBS_VERTICAL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0,0,0,0, form, NULL, ghModule, NULL ); return checkWindow(hBar, PROGRESS_CLASS); }; void osGetProgressBarReqSize(WindowHandle bar, int *res) { LONG lStyle = GetWindowLong(bar,GWL_STYLE); if (lStyle & PBS_VERTICAL) { res[0] = GetSystemMetrics(SM_CXVSCROLL); res[1] = GetSystemMetrics(SM_CYVSCROLL)*2; } else { res[0] = GetSystemMetrics(SM_CXHSCROLL)*2; res[1] = GetSystemMetrics(SM_CYHSCROLL); } } void osSetProgressBarFraction(WindowHandle bar, int minPos, int maxPos, int pos) { SendMessage(bar, PBM_SETRANGE32, minPos, maxPos); SendMessage(bar, PBM_SETPOS, pos, 0); } int osGetProgressBarFraction(WindowHandle bar, int minPos, int maxPos) { return SendMessage(bar, PBM_GETPOS, 0, 0); } --- NEW FILE: Slider.c --- #include "Slider.h" #include "Internals.h" #include "Handlers_stub.h" WindowHandle osCreateHorzSlider(WindowHandle form) { HWND hSlider; hSlider = CreateWindow( TRACKBAR_CLASS, NULL, TBS_AUTOTICKS | TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0,0,0,0, form, NULL, ghModule, NULL ); return checkWindow(hSlider, TRACKBAR_CLASS); }; WindowHandle osCreateVertSlider(WindowHandle form) { HWND hSlider; hSlider = CreateWindow( TRACKBAR_CLASS, NULL, TBS_AUTOTICKS | TBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0,0,0,0, form, NULL, ghModule, NULL ); return checkWindow(hSlider, TRACKBAR_CLASS); }; void osGetSliderReqSize(WindowHandle slider, int *res) { RECT rect; LONG lStyle = GetWindowLong(slider,GWL_STYLE); SendMessage(slider, TBM_GETTHUMBRECT, 0, (LPARAM) &rect); res[0] = rect.right - rect.left + ((lStyle & TBS_HORZ) ? 32 : GetSystemMetrics(SM_CXVSCROLL)); res[1] = rect.bottom - rect.top + ((lStyle & TBS_VERT) ? 32 : GetSystemMetrics(SM_CYHSCROLL)); } void osSetSliderRange(WindowHandle slider, int minPos, int maxPos) { SendMessage(slider, TBM_SETRANGEMAX, FALSE, maxPos); SendMessage(slider, TBM_SETRANGEMIN, TRUE, minPos); } void osGetSliderRange(WindowHandle slider, int *minPos, int *maxPos) { *maxPos = SendMessage(slider, TBM_GETRANGEMAX, 0, 0); *minPos = SendMessage(slider, TBM_GETRANGEMIN, 0, 0); } int osGetSliderPosition(WindowHandle slider) { return SendMessage(slider, TBM_GETPOS, 0, 0); } void osSetSliderPosition(WindowHandle slider, int pos) { SendMessage(slider, TBM_SETPOS, TRUE, pos); } Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Window.c 26 Mar 2003 22:21:58 -0000 1.14 --- Window.c 27 Mar 2003 13:36:23 -0000 1.15 *************** *** 290,293 **** --- 290,294 ---- break; case WM_VSCROLL: + if (lParam == 0) { RECT rect; *************** *** 346,352 **** } } ! break; case WM_HSCROLL: { RECT rect; --- 347,357 ---- } } ! else ! { ! handleControlCommand((WindowHandle) lParam); ! } break; case WM_HSCROLL: + if (lParam == 0) { RECT rect; *************** *** 405,408 **** --- 410,417 ---- } } + else + { + handleControlCommand((WindowHandle) lParam); + } break; case WM_MOUSEWHEEL: |