home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2004 March / PCWELT_3_2004.ISO / pcwsoft / flaskmpeg_078_39_src.z.exe / flaskmpeg / flarea.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-28  |  1.7 KB  |  71 lines

  1. /* 
  2.  *  flarea.h    -  Controls FlasKMPEG options
  3.  *
  4.  *    Copyright (C) Alberto Vigata - January 2000
  5.  *
  6.  *  This file is part of FlasKMPEG, a free MPEG to MPEG/AVI converter
  7.  *    
  8.  *  FlasKMPEG is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  FlasKMPEG is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  */
  23.  
  24.  
  25. #ifndef FLAREA_H
  26. #define FLAREA_H
  27.  
  28. #include <windows.h>
  29.  
  30. // Class to control user mouse actions
  31. class FlArea
  32. {
  33. public:
  34.   /* Sets the area at point x,y with dimensions w, h */
  35.   bool Set(int x, int y, int w, int h, int nType)
  36.   {
  37.     #define clip(x) ((x)<0 ? 0 : (x))
  38.   
  39.     w = clip(w);
  40.     h = clip(h);
  41.  
  42.     m_area.left  = clip(x - (w>>1));
  43.     m_area.right = clip(x + (w>>1));
  44.     m_area.top   = clip(y - (h>>1));
  45.     m_area.bottom = clip(y + (h>>1));
  46.     m_nType = nType;
  47.     return true;
  48.   }
  49.  
  50.   bool Poll(int x, int y)
  51.   {
  52.     bool ret;
  53.  
  54.     ret = ( x>m_area.left && x<m_area.right &&
  55.             y>m_area.top  && y<m_area.bottom );
  56.  
  57.     return ret;
  58.   }
  59.  
  60.   int GetType(){ return m_nType; }
  61. private:
  62.   RECT m_area;
  63.   int m_nType;
  64.   int m_nState;
  65. };
  66.  
  67.  
  68.  
  69.  
  70.  
  71. #endif