HaikuDepot: notify work status from main window
[haiku.git] / src / libs / glut / glutWindow.h
blob4417468b8361c92c513a8ae7b59aa86ca7115bfd
1 /***********************************************************
2 * Copyright (C) 1997, Be Inc. Copyright (C) 1999, Jake Hamby.
4 * This program is freely distributable without licensing fees
5 * and is provided without guarantee or warrantee expressed or
6 * implied. This program is -not- in the public domain.
8 * DESCRIPTION: the GlutWindow class saves all events for
9 * handling by main thread
10 ***********************************************************/
12 #include <GL/glut.h>
13 #include <Window.h>
14 #include <GLView.h>
17 /*! All information needed for windows and
18 subwindows (handled as similarly as possible).
20 class GlutWindow : public BGLView {
21 public:
22 GlutWindow(GlutWindow *nparent, const char *name, int x, int y, int width,
23 int height, ulong options);
25 virtual void MessageReceived(BMessage *message);
26 void KeyDown(const char *bytes, int32 numBytes);
27 void KeyUp(const char *bytes, int32 numBytes);
28 void MouseDown(BPoint point);
29 void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
30 void FrameResized(float width, float height);
31 void Draw(BRect updateRect);
32 void Pulse(); // needed since MouseUp() is broken
33 void MouseCheck(); // check for button state changes
34 void ErrorCallback(unsigned long errorCode);
36 static status_t MenuThread(void *menu);
38 int num; // window number returned to user
39 int cursor; // my cursor
40 #define GLUT_MAX_MENUS 3
41 int menu[GLUT_MAX_MENUS]; // my popup menus
42 int m_width, m_height; // the last width and height reported to GLUT
43 uint32 m_buttons; // the last mouse button state
45 /* Window relationship state. */
46 GlutWindow *parent; /* parent window */
47 GlutWindow *children; /* first child window */
48 GlutWindow *siblings; /* next sibling */
50 // leave out buttons and dials callbacks that we don't support
51 GLUTdisplayCB display; /* redraw */
52 GLUTreshapeCB reshape; /* resize (width,height) */
53 GLUTmouseCB mouse; /* mouse (button,state,x,y) */
54 GLUTmotionCB motion; /* motion (x,y) */
55 GLUTpassiveCB passive; /* passive motion (x,y) */
56 GLUTentryCB entry; /* window entry/exit (state) */
57 GLUTkeyboardCB keyboard; /* keyboard (ASCII,x,y) */
58 GLUTkeyboardCB keyboardUp; /* keyboard up (ASCII,x,y) */
59 GLUTvisibilityCB visibility; /* visibility */
60 GLUTspecialCB special; /* special key */
61 GLUTspecialCB specialUp; /* special key up */
62 GLUTwindowStatusCB windowStatus; /* window status */
64 bool anyevents; // were any events received?
65 bool displayEvent; // call display
66 bool reshapeEvent; // call reshape
67 bool mouseEvent; // call mouse
68 bool motionEvent; // call motion
69 bool passiveEvent; // call passive
70 bool entryEvent; // call entry
71 bool keybEvent; // call keyboard
72 bool keybUpEvent; // call keyboard
73 bool windowStatusEvent; // call visibility
74 bool specialEvent; // call special
75 bool specialUpEvent; // call special
76 bool statusEvent; // menu status changed
77 bool menuEvent; // menu selected
79 int button, mouseState; // for mouse callback
80 int mouseX, mouseY; // for mouse callback
81 int motionX, motionY; // for motion callback
82 int passiveX, passiveY; // for passive callback
83 int entryState; // for entry callback
84 unsigned char key; // for keyboard callback
85 int keyX, keyY; // for keyboard callback
86 int visState; // for visibility callback
87 int specialKey; // for special key callback
88 int specialX, specialY; // for special callback
89 int modifierKeys; // modifier key state
90 int menuStatus; // for status callback
91 int statusX, statusY; // for status callback
92 int menuNumber; // for menu and status callbacks
93 int menuValue; // for menu callback
94 bool visible; // for visibility callback
95 bool ignoreKeyRepeat;
98 /***********************************************************
99 * CLASS: GlutBWindow
101 * INHERITS FROM: BDirectWindow
103 * DESCRIPTION: basically a BWindow that won't quit
104 ***********************************************************/
105 class GlutBWindow : public BDirectWindow {
106 public:
107 GlutBWindow(BRect frame, const char *name);
108 ~GlutBWindow();
110 void DirectConnected(direct_buffer_info *info);
111 bool QuitRequested(); // exits app
112 void Minimize(bool minimized); // minimized windows are not visible
113 void Hide();
114 void Show();
115 GlutWindow *bgl;
116 bool fConnectionDisabled;