cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
svlWindowManagerBase.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Balazs Vagvolgyi
7  Created on: 2008
8 
9  (C) Copyright 2006-2008 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 
20 */
21 
22 #ifndef _svlWindowManagerBase_h
23 #define _svlWindowManagerBase_h
24 
26 
27 // Always include last!
29 
30 
31 // Forward declarations
33 class osaThread;
34 class osaThreadSignal;
35 
36 
38 {
39 friend class svlWindowManagerBase;
40 
41 public:
42  virtual ~svlWindowEventHandlerBase();
43 
44  virtual void OnNewFrame(unsigned int frameid);
45  virtual void OnUserEvent(unsigned int winid, bool ascii, unsigned int eventid);
46  void GetMousePos(int & x, int & y);
47 
48 private:
49  int MouseX;
50  int MouseY;
51 
52  // called by the Window Manager
53  void SetMousePos(int x, int y);
54 };
55 
56 
58 {
59 public:
61  svlWindowManagerBase(unsigned int numofwins);
62  virtual ~svlWindowManagerBase();
63  void SetNumberOfWindows(unsigned int numofwins);
64  void SetEventHandler(svlWindowEventHandlerBase* handler);
65  void SetTitleText(const std::string title);
66  void SetTimestamp(double timestamp);
67  int SetClientSize(unsigned int width, unsigned int height, unsigned int winid);
68  int SetWindowPosition(int x, int y, unsigned int winid);
69  void ResetInitEvent();
70  int WaitForInitEvent();
71 
72  // methods to overwrite
73  virtual int DoModal(bool show, bool fullscreen) = 0;
74  virtual void Show(bool show, int winid) = 0;
75  virtual void LockBuffers();
76  virtual void UnlockBuffers();
77  virtual void SetImageBuffer(unsigned char *buffer, unsigned int buffersize, unsigned int winid) = 0;
78  virtual void DrawImages() = 0;
79 // virtual void Destroy() = 0;
80  virtual void DestroyThreadSafe() = 0;
81 
82 protected:
83  std::string Title;
84  double Timestamp;
85  unsigned int NumOfWins;
86  unsigned int *Width, *Height;
87  int *PosX, *PosY;
90 
91  void OnNewFrame(unsigned int frameid);
92  void OnUserEvent(unsigned int winid, bool ascii, unsigned int eventid);
93  void GetMousePos(int& x, int& y);
94  void SetMousePos(int x, int y);
95 };
96 
97 #endif // _svlWindowManagerBase_h
98 
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
unsigned int * Width
Definition: svlWindowManagerBase.h:86
void OnUserEvent(unsigned int winid, bool ascii, unsigned int eventid)
void OnNewFrame(unsigned int frameid)
Define a thread object.
Definition: osaThread.h:164
void GetMousePos(int &x, int &y)
int * PosY
Definition: svlWindowManagerBase.h:87
Macros to export the symbols of cisstStereoVision (in a Dll).
std::string Title
Definition: svlWindowManagerBase.h:83
Definition: svlWindowManagerBase.h:57
svlWindowEventHandlerBase * EventHandler
Definition: svlWindowManagerBase.h:88
osaThreadSignal * InitReadySignal
Definition: svlWindowManagerBase.h:89
Definition: osaThreadSignal.h:40
Definition: svlWindowManagerBase.h:37
double Timestamp
Definition: svlWindowManagerBase.h:84
unsigned int NumOfWins
Definition: svlWindowManagerBase.h:85
void SetMousePos(int x, int y)