Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

unatdisp.hpp

00001 /* ==================================================== ======== ======= * 00002 * 00003 * unatdisp.hpp [Native Layer: platform dependent implementation] 00004 * Ubit Project [Elc][2003] 00005 * Author: Eric Lecolinet 00006 * 00007 * Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs 00008 * 00009 * (C) 1999-2003 Eric Lecolinet @ ENST Paris 00010 * WWW: http://www.enst.fr/~elc/ubit Email: elc@enst.fr (subject: ubit) 00011 * 00012 * *********************************************************************** 00013 * COPYRIGHT NOTICE : 00014 * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 00015 * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 00016 * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 00017 * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 00018 * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION. 00019 * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS. 00020 * *********************************************************************** 00021 * 00022 * ==================================================== [Elc:03] ======= * 00023 * ==================================================== ======== ======= */ 00024 00025 #ifndef _unatdisp_hpp_ 00026 #define _unatdisp_hpp_ 00027 //pragma ident "@(#)unatdisp.hpp ubit:03.06.04" 00028 #include <ubit/ubit_config.h> 00029 #include <ubit/unatwin.hpp> 00030 #include <ubit/uappli.hpp> 00031 00032 00033 class UNatDisp { 00034 public: 00035 UNatDisp(UDisp&); 00036 virtual ~UNatDisp(); 00037 00038 int getStatus() const; 00044 UDisp& getDisp() const {return disp;} 00046 00047 int getID() const {return id;} 00048 00049 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00050 // X Window 00051 00052 struct { 00053 UX_Atom PRIMARY_SELECTION, SECONDARY_SELECTION, 00054 WM_PROTOCOLS, WM_DELETE_WINDOW, WM_TAKE_FOCUS, 00055 UBIT_SELECTION, UBIT_MESSAGE, UBIT_WINDOW; 00056 } atoms; 00057 00058 void realize(); 00060 00061 bool isRealized() const; 00063 00064 UX_Display getXDisplay() const {return xdisplay;} 00065 UX_Screen getXScreen() const {return xscreen;} 00066 UX_Visual getXVisual() const {return xvisual;} 00067 UX_Colormap getXColormap() const {return xcmap;} 00068 UX_Window getXRootWindow() const; 00069 UX_Window getXWindow() const {return xwin;} 00070 00071 int getScreenWidth() const; 00073 00074 int getScreenHeight() const; 00076 00077 int getDepth() const {return depth;} 00079 00080 int getScreenDefaultDepth() const; 00082 00083 int getScreenNumber() const; 00085 00086 int getScreenCount() const; 00088 00089 unsigned long getRedMask() const {return red_mask;} 00090 unsigned long getGreenMask() const {return green_mask;} 00091 unsigned long getBlueMask() const {return blue_mask;} 00092 int getRedShift() const {return red_shift;} 00093 int getGreenShift() const {return green_shift;} 00094 int getBlueShift() const {return blue_shift;} 00095 int getRedBits() const {return red_bits;} 00096 int getGreenBits() const {return green_bits;} 00097 int getBlueBits() const {return blue_bits;} 00099 00100 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00101 // OpenGL 00102 00103 #ifdef WITH_GL 00104 00105 bool initGL(); 00106 00108 UX_VisualInfo getGLVisual() const {return glvisual;} 00109 00110 void resizeGLViewport(u_dim w, u_dim h); 00111 00113 void setGLColor(UX_Color pixel); 00114 void setGLColor(UX_Color pixel, GLubyte alpha); 00115 void setGLColor(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); 00116 00118 void toGLColor(UX_Color, GLubyte& red, GLubyte& green, GLubyte& blue); 00119 00121 GLuint getGLFont(const class UFontDesc&); 00122 #endif 00123 00124 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00125 // Colors 00126 00127 UX_Color getColor(const UColor& c) {return getColor(c.getImpl());} 00128 UX_Color getColor(class UColorImpl&); 00132 bool realizeColor(const UColor& c) {return realizeColor(c.getImpl());} 00133 bool realizeColor(class UColorImpl&); 00138 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00139 // Mouse Cursors 00140 00141 UX_Cursor getCursor(const UCursor&); 00145 bool realizeCursor(const UCursor&); 00149 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00150 // Fonts 00151 00152 UX_Font getFont(const class UFontDesc&); 00156 bool realizeFont(const class UFont&); 00157 bool realizeFont(const class UFontDesc&); 00158 bool realizeFontFamily(const class UFontFamily&); 00159 UX_Font loadNatFont(const class UFontFamily&, int styles, int lsize); 00163 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00164 // Visuals 00165 00166 00167 //bool setScreen(int screen_no); 00173 int setVisual(const XVisualInfo&, UX_Colormap = None); 00180 int setVisual(int visual_class, int depth_hint, bool linear_gamma, 00181 UX_Colormap = None); 00199 int chooseVisual(XVisualInfo&, int visual_class, int depth_hint, 00200 bool linear_gamma); 00215 bool findExactVisual(XVisualInfo&, int visual_class, int depth, 00216 bool linear_gamma); 00217 00218 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00219 // X selection 00220 00221 bool askSelectionOwnership(class UEvent&); 00226 void changeSelectionContentRequest(UX_Event, class UTextsel&); 00227 // Cas ou une autre application demande a obtenir la valeur de la 00228 // selection courante (detenue par 'this' appli) 00229 // l'event doit etre un XSelectionRequestEvent 00230 00231 void askSelectionContent(class UEvent&, 00232 class UStr* put_to_this_str, int put_to_this_pos); 00239 void retrieveSelectionContentRequest(UX_Event); 00240 // the XEvent must be a XSelectionEvent event. 00241 // recupere le contenu de la selection lorsque le NatDisp recoit un 00242 // SelectionNotify event apres avoir demande le contenu de la selection 00243 // en appellant askSelectionContent() 00244 // the XEvent must be a XSelectionEvent event. 00245 00246 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00247 // Internal data 00248 00249 class UNatGraph* getSharedGraph() const {return sharedGraph;} 00251 00252 class UNatGraph* getClientGraph() const {return clientGraph;} 00254 00255 UX_Pixmap getDefaultPixmap() const {return defaultPixmap;} 00257 00258 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00259 // Event management 00260 00261 void dispatchEvents(UX_Event); 00263 00264 void showNotify(UX_Window, bool shows); 00266 00267 class UFlow* retrieveFlow(unsigned int ev_state, unsigned long flow_id); 00269 00270 void on_selection(UWin*, UView*, UX_Event); 00271 void on_raw_event(UWin*, UView*, UX_Event); 00272 void on_expose(UWin*, UView*, UX_Event); 00273 void on_configure(UWin*, UView*, UX_Event); 00274 void on_mpress(UWin*, UView*, UX_Event); 00275 void on_mrelease(UWin*, UView*, UX_Event); 00276 void on_mmove(UWin*, UView*, UX_Event); 00277 void on_kpress(UWin*, UView*, UX_Event); 00278 void on_krelease(UWin*, UView*, UX_Event); 00279 void on_enter(UWin*, UView*, UX_Event); 00280 void on_leave(UWin*, UView*, UX_Event); 00281 void on_focus(UWin*, UView*, UX_Event); 00282 void on_notify(UWin*, UView*, UX_Event); 00283 00284 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00285 00286 private: 00287 friend class UNatAppli; 00288 friend class UWinGraph; 00289 friend class UGraph; 00290 friend bool UNatWin::realizeMainFrame(UNatDisp*, UNatWin*, UWin *win); 00291 00292 class UDisp &disp; // abstract display counterpart 00293 const int id; 00294 int stat; 00295 UX_Display xdisplay; 00296 UX_Screen xscreen; 00297 UX_Visual xvisual; 00298 UX_Colormap xcmap; 00299 UX_Window xwin; // used for getting depth, etc for drawing pixmaps... 00300 int xconnection; 00301 int depth; 00302 unsigned long red_mask, green_mask, blue_mask; 00303 int red_shift, green_shift, blue_shift; 00304 int red_bits, green_bits, blue_bits; 00305 00306 UX_Font** fontFamilyMap; 00307 unsigned long fontFamilyCount; 00308 00309 //default Pixmap with same depth as UNatDisp 00310 UX_Pixmap defaultPixmap; 00311 00312 #ifdef WITH_GL 00313 GLXContext glxc; 00314 UX_VisualInfo glvisual; // GL visual info 00315 GLuint** glFontFamilyMap; // array of display list ids 00316 #endif 00317 00318 // used by UWinGraph objects for standard toolkit drawing 00319 UNatGraph* sharedGraph; 00320 // used by UGraph objects for appli. drawing 00321 UNatGraph* clientGraph; 00322 00323 // the UStr where the Server selection must be inserted 00324 class UStr *server_selection_str; 00325 int server_selection_pos; 00326 }; 00327 00328 #endif 00329 /* ==================================================== [TheEnd] ======= */ 00330 /* ==================================================== [Elc:03] ======= */

Generated on Fri Aug 13 12:12:14 2004 for Ubit[Eric.Lecolinet@enst.fr] by doxygen 1.3.7