~alexandre-hardy/guidegl/trunk

« back to all changes in this revision

Viewing changes to include/guide/DesktopWindowGLFW.h

  • Committer: Alexandre Hardy
  • Date: 2009-07-08 12:25:35 UTC
  • Revision ID: ah@tuba-20090708122535-0k8o8ri2jojd43cx
Import of initial sourceforge project

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __DesktopWindow
 
2
#define __DesktopWindow
 
3
 
 
4
#include <guide/Container.h>
 
5
#include <guide/Desktop.h>
 
6
#include <guide/WidgetEvents.h>
 
7
#include <guide/DesktopWindowEvents.h>
 
8
#include <guide/Pixmap.h>
 
9
#include <GL/glfw.h>
 
10
 
 
11
class Tooltip;
 
12
class VMenu;
 
13
 
 
14
typedef void (*paint_f)();
 
15
 
 
16
class DesktopWindow:public Container {
 
17
        public:
 
18
                DesktopWindow();
 
19
                DesktopWindow(int width, int height, const string &caption, int fullscreen);
 
20
                DesktopWindow(int width, int height, int fullscreen);
 
21
                DesktopWindow(const string &caption, int fullscreen);
 
22
                virtual ~DesktopWindow();
 
23
                Property caption;
 
24
                virtual vector<EventHandler *> getEventHandlers();
 
25
                virtual vector<string> getMethods();
 
26
                int getGlutWindow();
 
27
                void setHandler(DesktopWindowEvents *h);
 
28
                DesktopWindowEvents *getDesktopWindowHandler(void);
 
29
                void kbd_down(int key, double x, double y);
 
30
                void kbd_up(int key, double x, double y);
 
31
                void mouse_press(int button, double x, double y);
 
32
                void mouse_release(int button, double x, double y);
 
33
                void kbd_special(int key, double x, double y);
 
34
                void kbd_special_up(int key, double x, double y);
 
35
                void mouse_motion(int button, double x, double y);
 
36
                void reshape(double width, double height);
 
37
                void enter();
 
38
                void leave();
 
39
                void PropertyChanged(int id, string name);
 
40
                void paint();
 
41
                int grabMouse(Widget *w);
 
42
                int grabKbd(Widget *w);
 
43
                void releaseMouse(Widget *w);
 
44
                void releaseKbd(Widget *w);
 
45
                void setCursor(Pixmap *p);
 
46
                void setBackground(Pixmap *p);
 
47
                void setBackground(paint_f p);
 
48
                void setHotspot(double x, double y);
 
49
                void showTooltip(const string &text);
 
50
                void PopupMenu(VMenu *vm);
 
51
                int closeClicked(void);
 
52
                void refresh(void);
 
53
 
 
54
                friend void GLFWCALL guide_display(void);
 
55
                friend void GLFWCALL guide_idle(void);
 
56
                friend void GLFWCALL guide_kbd(int key, int state);
 
57
                friend void GLFWCALL guide_mouse(int button, int state);
 
58
                friend void GLFWCALL guide_special(int key, int state);
 
59
                friend void GLFWCALL guide_motion(int x, int y);
 
60
                friend void GLFWCALL guide_reshape(int width, int height);
 
61
                friend void GLFWCALL guide_entry(int state);
 
62
                friend int GLFWCALL guide_close();
 
63
 
 
64
        protected:
 
65
                int window;
 
66
                void setup(int width, int height, const string &caption, int fullscreen);
 
67
                DesktopWindowEvents *handler;
 
68
                Widget *kbdgrabber;
 
69
                Widget *mousegrabber;
 
70
                Pixmap *cursor;
 
71
                double cx, cy; //cursor position
 
72
                double hx, hy; //cursor hotspot 
 
73
                Tooltip *tip;
 
74
                Pixmap *bgimage;
 
75
                paint_f painter_function;
 
76
};
 
77
 
 
78
extern DesktopWindow *root;
 
79
#endif