00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __RE_Server__
00020 #define __RE_Server__
00021
00022 #include <SYS/SYS_Types.h>
00023 #include <UT/UT_PtrArray.h>
00024 #include <UT/UT_Rect.h>
00025
00026 #include "RE_API.h"
00027 #include "RE_Types.h"
00028
00029 class RE_Window;
00030 class RE_Render;
00031
00032 class RE_API RE_Server
00033 {
00034 public:
00035 RE_Server();
00036 virtual ~RE_Server();
00037
00038 virtual char initServer(char *data = 0);
00039 virtual void flush() const = 0;
00040
00041
00042
00043
00044
00045
00046 void setUseLock(int state) { myUseLock = state; }
00047 int getUseLock() const { return myUseLock; }
00048
00049 virtual void lock(const char *msg=0);
00050 virtual void unlock(const char *msg=0);
00051
00052 RE_IDType getFocusWindow() const { return focusWindow; }
00053 void setFocusWindow(RE_IDType wid);
00054
00055 static void setMinRes( int xmin, int ymin );
00056 static int getMinXRes() { return myMinXRes; }
00057 static int getMinYRes() { return myMinYRes; }
00058 int meetsMinRes( );
00059
00060
00061
00062
00063 virtual bool windowUnderCursor(RE_IDType wid,
00064 int x, int y);
00065
00066 virtual bool getColorUnderCursor(float color[3]);
00067
00068 virtual Display *getDisplay() const { return NULL; }
00069
00070 #ifdef PLATFORM_OPEN_GL
00071 virtual short getWidth() const = 0;
00072 virtual short getHeight() const = 0;
00073 virtual short getWidthMM() const = 0;
00074 virtual short getHeightMM() const = 0;
00075 virtual bool GLMakeCurrent( OGLDrawable draw, RE_OGLContext context ) = 0;
00076 virtual int GLMakeCopyCurrent( OGLDrawable draw,
00077 RE_OGLContext sourceContext,
00078 RE_OGLContext targetContext ) = 0;
00079 virtual void GLSwapBuffers(RE_Window *currentWindow) = 0;
00080 virtual OGLDrawable GLGetCurrentDrawable() = 0;
00081 virtual void GLWaitGL() = 0;
00082
00083
00084 virtual int getDragTolX() const { return 4; }
00085 virtual int getDragTolY() const { return 4; }
00086 virtual fpreal64 getDragDelay() const { return 0.75; }
00087 #endif
00088
00089 virtual UT_DimRect getWorkArea() = 0;
00090
00091
00092
00093 void addCurrentMainWindow(RE_Window *win);
00094
00095
00096 void removeCurrentMainWindow(RE_Window *win);
00097
00098
00099
00100
00101 RE_Window *getCurrentMainWindow() const;
00102
00103
00104
00105
00106 RE_Window *getFirstCurrentMainWindow() const;
00107
00108
00109 RE_Window *newWindow(RE_DisplayMode mode,
00110 RE_WindowType type,
00111 RE_VisualType visType=RE_NORMAL_VIS,
00112 RE_WindowVisibility doOffScreen
00113 = RE_WINDOW_VISIBLE,
00114 bool alwaysOnTop = false);
00115
00116
00117
00118
00119 RE_Render *getContextMatching(RE_DisplayMode mode) const;
00120
00121 protected:
00122 RE_IDType focusWindow;
00123
00124 private:
00125
00126
00127
00128
00129 UT_PtrArray<RE_Window *> myCurrentMainWindows;
00130 int myUseLock;
00131
00132 static int myMinXRes;
00133 static int myMinYRes;
00134 };
00135
00136 class RE_ServerAutoLock
00137 {
00138 public:
00139 RE_ServerAutoLock(RE_Server& server, const char* message)
00140 : myServer(server)
00141 , myMessage(message)
00142 { myServer.lock(message); }
00143
00144 ~RE_ServerAutoLock()
00145 { myServer.unlock(myMessage); }
00146
00147 private:
00148 RE_Server& myServer;
00149 const char* myMessage;
00150 };
00151
00152 #endif