Update the changelog
[opencv] / filters / CamShift / utils.h
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 //  By downloading, copying, installing or using the software you agree to this license.
6 //  If you do not agree to this license, do not download, install,
7 //  copy or use the software.
8 //
9 //
10 //                        Intel License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
15 //
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
18 //
19 //   * Redistribution's of source code must retain the above copyright notice,
20 //     this list of conditions and the following disclaimer.
21 //
22 //   * Redistribution's in binary form must reproduce the above copyright notice,
23 //     this list of conditions and the following disclaimer in the documentation
24 //     and/or other materials provided with the distribution.
25 //
26 //   * The name of Intel Corporation may not be used to endorse or promote products
27 //     derived from this software without specific prior written permission.
28 //
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
39 //
40 //M*/#ifndef __VEL_UTILS_H__
41 #define __VEL_UTILS_H__
42
43 #define BEGIN_MESSAGE_MAP(DialogName)                  \
44   LRESULT CALLBACK DialogName##_DlgProc(HWND hwnd,     \
45                                         UINT uMsg,     \
46                                         WPARAM wParam, \
47                                         LPARAM lParam){
48
49 #define END_MESSAGE_MAP \
50   return FALSE; }
51
52 #define ON_MSG(message,fn) \
53   if ((uMsg) == (message)) \
54     return (BOOL)HANDLE_##message((hwnd), (wParam), (lParam), (fn));
55
56 #define ON_BN_CLICKED(id,fn) \
57   if ((uMsg)         == WM_COMMAND && \
58       HIWORD(wParam) == BN_CLICKED && \
59       LOWORD(wParam) == (id)) { (fn)(); return TRUE; }
60
61 // Slider macros
62 #define Slider_GetLineSize(hwnd)                SendMessage(hwnd, TBM_GETLINESIZE, 0, 0l)
63 #define Slider_SetLineSize(hwnd,nSize)          SendMessage(hwnd, TBM_SETLINESIZE, 0, nSize)
64 #define Slider_GetPageSize(hwnd)                SendMessage(hwnd, TBM_GETPAGESIZE, 0, 0l)
65 #define Slider_SetPageSize(hwnd,nSize)          SendMessage(hwnd, TBM_SETPAGESIZE, 0, nSize)
66 #define Slider_GetRangeMin(hwnd)                SendMessage(hwnd, TBM_GETRANGEMIN, 0, 0l)
67 #define Slider_GetRangeMax(hwnd)                SendMessage(hwnd, TBM_GETRANGEMAX, 0, 0l)
68 #define Slider_GetRange(hwnd,pnMin,pnMax)                 \
69   (*(pnMin) =  SendMessage(hwnd, TBM_GETRANGEMIN, 0, 0l), \
70    *(pnMin) =  SendMessage(hwnd, TBM_GETRANGEMAX, 0, 0l))
71
72 #define Slider_SetRangeMin(hwnd,nMin,bRedraw)   SendMessage(hwnd, TBM_SETRANGEMIN, bRedraw, nMin)
73 #define Slider_SetRangeMax(hwnd,nMax,bRedraw)   SendMessage(hwnd, TBM_SETRANGEMAX, bRedraw, nMax)
74 #define Slider_SetRange(hwnd,nMin,nMax,bRedraw) SendMessage(hwnd, TBM_SETRANGE, bRedraw, MAKELONG(nMin,nMax))
75 #define Slider_ClearSel(hwnd,bRedraw)           SendMessage(hwnd, TBM_CLEARSEL, bRedraw, 0l)
76 #define Slider_GetChannelRect(hwnd,lprc)        SendMessage(hwnd, TBM_GETCHANNELRECT, 0, (LPARAM)lprc)
77 #define Slider_GetThumbRect(hwnd,lprc)          SendMessage(hwnd, TBM_GETTHUMBRECT, 0, (LPARAM)lprc)
78 #define Slider_GetPos(hwnd)                     SendMessage(hwnd, TBM_GETPOS, 0, 0l)
79 #define Slider_SetPos(hwnd,nPos)                SendMessage(hwnd, TBM_SETPOS, TRUE, nPos)
80 #define Slider_VerifyPos(hwnd)                  SendMessage(hwnd, TBM_SETPOS, FALSE, 0L)
81 #define Slider_ClearTics(hwnd,bRedraw)          SendMessage(hwnd, TBM_CLEARTICS, bRedraw, 0l)
82 #define Slider_GetNumTics(hwnd)                 SendMessage(hwnd, TBM_GETNUMTICS, 0, 0l)
83 #define Slider_GetTicArray(hwnd)                ((DWORD*)SendMessage(hwnd, TBM_GETPTICS, 0, 0l))
84 #define Slider_GetTic(hwnd,nTic)                SendMessage(hwnd, TBM_GETTIC, nTic, 0L)
85 #define Slider_GetTicPos(hwnd,nTic)             SendMessage(hwnd, TBM_GETTICPOS, nTic, 0L)
86 #define Slider_SetTic(hwnd,nTic)                SendMessage(hwnd, TBM_SETTIC, 0, nTic))
87 #define Slider_SetTicFreq(hwnd,nFreq)           SendMessage(hwnd, TBM_SETTICFREQ, nFreq, 0L)
88
89 // Spin macros
90 #define Spin_GetAccel(hwnd, nAccel,pAccel)      ((UINT) LOWORD(SendMessage(hwnd, UDM_GETACCEL, nAccel, (LPARAM)pAccel)))
91 #define Spin_GetBase(hwnd)                      ((UINT) LOWORD(SendMessage(hwnd, UDM_GETBASE, 0, 0l)))
92 #define Spin_GetBuddy(hwnd)                     ((HWND) SendMessage(hwnd, UDM_GETBUDDY, 0, 0l))
93 #define Spin_GetPos(hwnd)                       ((int)  SendMessage(hwnd, UDM_GETPOS, 0, 0l))
94 #define Spin_GetRange(hwnd)                     ((DWORD)SendMessage(hwnd, UDM_GETRANGE, 0, 0l))
95 #define Spin_SetAccel(hwnd,nAccel,pAccel)       SendMessage(hwnd, UDM_SETACCEL, nAccel, (LPARAM)pAccel))
96 #define Spin_SetBase(nBase)                     SendMessage(hwnd, UDM_SETBASE, nBase, 0L))
97 #define Spin_SetBuddy(hwndBuddy)                SendMessage(hwnd, UDM_SETBUDDY, hwndBuddy, 0L))
98 #define Spin_SetPos(hwnd, nPos)                 SendMessage(hwnd, UDM_SETPOS, 0, MAKELPARAM(nPos, 0))
99 #define Spin_SetRange(hwnd, nLower,nUpper)      SendMessage(hwnd, UDM_SETRANGE, 0, MAKELPARAM(nUpper, nLower))
100
101 #endif