TLIB documentation
 

tlDisplay.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  This file is part of the TLIB computer vision library.
00004 //  Copyright (C) 2003-2008 Sebastien Grange
00005 //  Copyright (C) 2003-2007 VRAI Group, EPFL
00006 //  All rights reserved.
00007 // 
00008 //  This library is free software; you can redistribute it and/or modify
00009 //  it under the terms of the GNU General Public License("GPL") version 2
00010 //  as published by the Free Software Foundation.
00011 // 
00012 //  <http://www.tuyphon.com/tlib>
00013 //
00014 /////////////////////////////////////////////////////////////////////////////////
00015 
00016 
00017 #ifndef __TLDISPLAY_H__
00018 #define __TLDISPLAY_H__
00019 
00020 
00021 
00022 #include "tlVision.h"
00023 #include "tlSize.h"
00024 #include "tlLocation.h"
00025 #include "tlRect.h"
00026 
00027 
00028 
00029 
00030 // constants
00031 #define TL_MAX_DISPLAY           10
00032 #define TL_DISPLAY_NAME         "TLIB window"
00033 
00034 
00035 // event list
00036 #define TL_NO_EVENT               0
00037 #define TL_EVENT                  1
00038 #define TL_EVENT_EXIT             2
00039 #define TL_EVENT_MOUSE            3
00040 #define TL_EVENT_MOUSEDOWN        4
00041 #define TL_EVENT_MOUSEUP          5
00042 #define TL_EVENT_LMOUSE           6
00043 #define TL_EVENT_LMOUSEDOWN       7
00044 #define TL_EVENT_LMOUSEUP         8
00045 #define TL_EVENT_RMOUSE           9
00046 #define TL_EVENT_RMOUSEDOWN      10
00047 #define TL_EVENT_RMOUSEUP        11
00048 #define TL_EVENT_MMOUSE          12
00049 #define TL_EVENT_MMOUSEDOWN      13
00050 #define TL_EVENT_MMOUSEUP        14
00051 #define TL_EVENT_MOUSEDBLCLK     15
00052 #define TL_EVENT_MOUSERECT       16
00053 #define TL_EVENT_KEY             17
00054 #define TL_EVENT_KEYDOWN         18
00055 #define TL_EVENT_KEYUP           19
00056 
00057 
00058 
00059 // class declaration
00060 class tlDisplay
00061 {
00062 
00063 private:
00064   // window
00065   int  x;
00066   int  y;
00067   int  width;
00068   int  height;
00069   int  ID;
00070   bool visible;
00071   char *name;
00072 
00073   int  init   (char *filename, int x, int y);
00074   int  update ();
00075 
00076 public:
00077   tlDisplay  ();
00078   tlDisplay  (int x, int y);
00079   tlDisplay  (char *name);
00080   tlDisplay  (char *name, int x, int y);
00081   virtual ~tlDisplay ();
00082 
00083   // window routines
00084   bool getVisible () { return visible; };
00085   int  getID      () { return ID;  };
00086   int  getWidth   () { return width;  };
00087   int  getHeight  () { return height; };
00088   int  getPosX    () { return x; }
00089   int  getPosY    () { return y; }
00090 
00091   int  getSize    (tlSize *size)          { return size->setSize (width, height); }
00092   int  getPos     (tlLocation *location)  { return location->setLocation (x, y); }
00093   int  getRect    (tlRect *rect)          { return rect->set (x, y, width, height); }
00094 
00095   int  setPos     (int x, int y);
00096   int  resize     (int width, int height);
00097   int  maximize   ();
00098   int  restore    ();
00099   int  minimize   ();
00100   int  close      ();
00101   int  show       ();
00102   int  hide       ();
00103   int  display    (tlPixelArray *pixelArray);
00104   int  display    (tlHist       *hist);
00105   int  display    (tlHist2D     *hist);
00106 
00107   // event management routines
00108   static bool       init_global;
00109   static bool       isInitialized  () { return init_global; };
00110   static void       initialize     ();
00111   static int        queryEvent     ();
00112   static int        event          ();
00113   static int        getLastEvent   ();
00114   static tlDisplay* getLastDisplay ();
00115   static tlPoint*   getMouse       ();
00116   static int        getMouse       (tlPoint *point);
00117   static tlPoint*   getMouseDown   ();
00118   static int        getMouseDown   (tlPoint *point);
00119   static tlPoint*   getMouseUp     ();
00120   static int        getMouseUp     (tlPoint *point);
00121   static tlPoint*   getMouseDouble ();
00122   static int        getMouseDouble (tlPoint *point);
00123   static tlRect*    getMouseRect   ();
00124   static int        getMouseRect   (tlRect  *rect);
00125   static char       getKeyDown     (); 
00126   static char       getKeyUp       ();
00127   static int        setMousePos    (int x, int y);
00128   static char       waitKey        ();
00129   static void       waitMouse      ();
00130 };
00131 
00132 #endif
00133 


TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.