00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#ifndef _unatdisp_hpp_
00026
#define _unatdisp_hpp_
00027
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
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
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
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
00140
00141 UX_Cursor getCursor(
const UCursor&);
00145
bool realizeCursor(
const UCursor&);
00149
00150
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
00165
00166
00167
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
00220
00221
bool askSelectionOwnership(
class UEvent&);
00226
void changeSelectionContentRequest(UX_Event,
class UTextsel&);
00227
00228
00229
00230
00231
void askSelectionContent(
class UEvent&,
00232
class UStr* put_to_this_str,
int put_to_this_pos);
00239
void retrieveSelectionContentRequest(UX_Event);
00240
00241
00242
00243
00244
00245
00246
00247
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
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;
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;
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
00310 UX_Pixmap defaultPixmap;
00311
00312
#ifdef WITH_GL
00313
GLXContext glxc;
00314 UX_VisualInfo glvisual;
00315 GLuint** glFontFamilyMap;
00316
#endif
00317
00318
00319
UNatGraph* sharedGraph;
00320
00321
UNatGraph* clientGraph;
00322
00323
00324
class UStr *server_selection_str;
00325
int server_selection_pos;
00326 };
00327
00328
#endif
00329
00330