|
|
|
@ -1982,22 +1982,6 @@ icvFindTrackbarByName( const CvWindow* window, const char* name ) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{ |
|
|
|
|
UINT cbSize; |
|
|
|
|
DWORD dwMask; |
|
|
|
|
int idCommand; |
|
|
|
|
int iImage; |
|
|
|
|
BYTE fsState; |
|
|
|
|
BYTE fsStyle; |
|
|
|
|
WORD cx; |
|
|
|
|
DWORD lParam; |
|
|
|
|
LPSTR pszText; |
|
|
|
|
int cchText; |
|
|
|
|
} |
|
|
|
|
ButtonInfo; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int |
|
|
|
|
icvCreateTrackbar( const char* trackbar_name, const char* window_name, |
|
|
|
|
int* val, int count, CvTrackbarCallback on_notify, |
|
|
|
@ -2017,7 +2001,7 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name, |
|
|
|
|
if( !window_name || !trackbar_name ) |
|
|
|
|
CV_ERROR( CV_StsNullPtr, "NULL window or trackbar name" ); |
|
|
|
|
|
|
|
|
|
if( count <= 0 ) |
|
|
|
|
if( count < 0 ) |
|
|
|
|
CV_ERROR( CV_StsOutOfRange, "Bad trackbar maximal value" ); |
|
|
|
|
|
|
|
|
|
window = icvFindWindowByName(window_name); |
|
|
|
@ -2027,8 +2011,8 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name, |
|
|
|
|
trackbar = icvFindTrackbarByName(window,trackbar_name); |
|
|
|
|
if( !trackbar ) |
|
|
|
|
{ |
|
|
|
|
TBBUTTON tbs; |
|
|
|
|
ButtonInfo tbis; |
|
|
|
|
TBBUTTON tbs = {0}; |
|
|
|
|
TBBUTTONINFO tbis = {0}; |
|
|
|
|
RECT rect; |
|
|
|
|
int bcount; |
|
|
|
|
int len = (int)strlen( trackbar_name ); |
|
|
|
@ -2038,9 +2022,14 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name, |
|
|
|
|
{ |
|
|
|
|
const int default_height = 30; |
|
|
|
|
|
|
|
|
|
window->toolbar.toolbar = CreateToolbarEx( |
|
|
|
|
window->frame, WS_CHILD | CCS_TOP | TBSTYLE_WRAPABLE, |
|
|
|
|
1, 0, 0, 0, 0, 0, 16, 20, 16, 16, sizeof(TBBUTTON)); |
|
|
|
|
// CreateToolbarEx is deprecated and forces linking against Comctl32.lib.
|
|
|
|
|
window->toolbar.toolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, |
|
|
|
|
WS_CHILD | CCS_TOP | TBSTYLE_WRAPABLE | BTNS_AUTOSIZE | BTNS_BUTTON, |
|
|
|
|
0, 0, 0, 0, |
|
|
|
|
window->frame, NULL, GetModuleHandle(NULL), NULL); |
|
|
|
|
// CreateToolbarEx automatically sends this but CreateWindowEx doesn't.
|
|
|
|
|
SendMessage(window->toolbar.toolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); |
|
|
|
|
|
|
|
|
|
GetClientRect(window->frame, &rect); |
|
|
|
|
MoveWindow( window->toolbar.toolbar, 0, 0, |
|
|
|
|
rect.right - rect.left, default_height, TRUE); |
|
|
|
@ -2288,6 +2277,38 @@ CV_IMPL void cvSetTrackbarPos( const char* trackbar_name, const char* window_nam |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CV_IMPL void cvSetTrackbarMax(const char* trackbar_name, const char* window_name, int maxval) |
|
|
|
|
{ |
|
|
|
|
CV_FUNCNAME( "cvSetTrackbarMax" ); |
|
|
|
|
|
|
|
|
|
__BEGIN__; |
|
|
|
|
|
|
|
|
|
if (maxval >= 0) |
|
|
|
|
{ |
|
|
|
|
CvWindow* window = 0; |
|
|
|
|
CvTrackbar* trackbar = 0; |
|
|
|
|
if (trackbar_name == 0 || window_name == 0) |
|
|
|
|
{ |
|
|
|
|
CV_ERROR(CV_StsNullPtr, "NULL trackbar or window name"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
window = icvFindWindowByName(window_name); |
|
|
|
|
if (window) |
|
|
|
|
{ |
|
|
|
|
trackbar = icvFindTrackbarByName(window, trackbar_name); |
|
|
|
|
if (trackbar) |
|
|
|
|
{ |
|
|
|
|
// The position will be min(pos, maxval).
|
|
|
|
|
trackbar->maxval = maxval; |
|
|
|
|
SendMessage(trackbar->hwnd, TBM_SETRANGEMAX, (WPARAM)TRUE, (LPARAM)maxval); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
__END__; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CV_IMPL void* cvGetWindowHandle( const char* window_name ) |
|
|
|
|
{ |
|
|
|
|
void* hwnd = 0; |
|
|
|
|