1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Private declarations common to X11 and Motif ports
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
17 #include "wx/colour.h"
20 #include "X11/Xatom.h"
21 #include "X11/Xutil.h"
27 // ----------------------------------------------------------------------------
28 // key events related functions
29 // ----------------------------------------------------------------------------
31 extern int wxCharCodeXToWX(KeySym keySym
);
32 extern KeySym
wxCharCodeWXToX(int id
);
34 int wxGetBestMatchingPixel(Display
*display
, XColor
*desiredColor
, Colormap cmap
);
35 Pixmap
XCreateInsensitivePixmap( Display
*display
, Pixmap pixmap
);
37 extern XColor g_itemColors
[];
38 extern int wxComputeColours (Display
*display
, wxColour
* back
, wxColour
* fore
);
41 inline Display
* wxGlobalDisplay() { return (Display
*) wxGetDisplay(); }
43 #define wxMAX_RGB 0xff
45 #define wxSIGN(x) ((x < 0) ? -x : x)
50 typedef struct wx_hsv
{
54 #define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
55 #define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
57 void wxHSVToXColor(wxHSV
*hsv
,XColor
*xcolor
);
58 void wxXColorToHSV(wxHSV
*hsv
,XColor
*xcolor
);
59 void wxAllocNearestColor(Display
*display
,Colormap colormap
,XColor
*xcolor
);
60 void wxAllocColor(Display
*display
,Colormap colormap
,XColor
*xcolor
);
64 wxString
wxGetXEventName(XEvent
& event
);
67 // Is the window visible?
68 bool wxWindowIsVisible(Window win
);
71 #define XEventGetWindow(event) event->general.wid
72 #define XEventGetType(event) event->general.type
73 #define XConfigureEventGetX(event) ((int) event->update.x)
74 #define XConfigureEventGetY(event) ((int) event->update.y)
75 #define XConfigureEventGetWidth(event) ((int) event->update.width)
76 #define XConfigureEventGetHeight(event) ((int) event->update.height)
77 #define XExposeEventGetX(event) event->exposure.x
78 #define XExposeEventGetY(event) event->exposure.y
79 #define XExposeEventGetWidth(event) event->exposure.width
80 #define XExposeEventGetHeight(event) event->exposure.height
81 #define XButtonEventGetTime(event) (wxGetLocalTime())
82 #define XButtonEventLChanged(event) (event->button.changebuttons & GR_BUTTON_L)
83 #define XButtonEventMChanged(event) (event->button.changebuttons & GR_BUTTON_M)
84 #define XButtonEventRChanged(event) (event->button.changebuttons & GR_BUTTON_R)
85 #define XButtonEventLIsDown(x) ((x)->button.buttons & GR_BUTTON_L)
86 #define XButtonEventMIsDown(x) ((x)->button.buttons & GR_BUTTON_M)
87 #define XButtonEventRIsDown(x) ((x)->button.buttons & GR_BUTTON_R)
88 #define XButtonEventShiftIsDown(x) (x->button.modifiers & MWKMOD_SHIFT)
89 #define XButtonEventCtrlIsDown(x) (x->button.modifiers & MWKMOD_CTRL)
90 #define XButtonEventAltIsDown(x) (x->button.modifiers & MWKMOD_ALT)
91 #define XButtonEventMetaIsDown(x) (x->button.modifiers & MWKMOD_META)
92 #define XButtonEventGetX(event) (event->button.x)
93 #define XButtonEventGetY(event) (event->button.y)
94 #define XKeyEventGetTime(event) (wxGetLocalTime())
95 #define XKeyEventGetX(event) (event->keystroke.x)
96 #define XKeyEventGetY(event) (event->keystroke.y)
97 #define XKeyEventShiftIsDown(x) (x->keystroke.modifiers & MWKMOD_SHIFT)
98 #define XKeyEventCtrlIsDown(x) (x->keystroke.modifiers & MWKMOD_CTRL)
99 #define XKeyEventAltIsDown(x) (x->keystroke.modifiers & MWKMOD_ALT)
100 #define XKeyEventMetaIsDown(x) (x->keystroke.modifiers & MWKMOD_META)
101 #define XFontStructGetAscent(f) f->info.baseline
105 #define XEventGetWindow(event) event->xany.window
106 #define XEventGetType(event) event->xany.type
107 #define XConfigureEventGetX(event) event->xconfigure.x
108 #define XConfigureEventGetY(event) event->xconfigure.y
109 #define XConfigureEventGetWidth(event) event->xconfigure.width
110 #define XConfigureEventGetHeight(event) event->xconfigure.height
111 #define XExposeEventGetX(event) event->xexpose.x
112 #define XExposeEventGetY(event) event->xexpose.y
113 #define XExposeEventGetWidth(event) event->xexpose.width
114 #define XExposeEventGetHeight(event) event->xexpose.height
115 #define XButtonEventGetTime(event) (event->xbutton.time)
116 #define XButtonEventLChanged(event) (event->xbutton.button == Button1)
117 #define XButtonEventMChanged(event) (event->xbutton.button == Button2)
118 #define XButtonEventRChanged(event) (event->xbutton.button == Button3)
119 #define XButtonEventLIsDown(x) ((x)->xbutton.state & Button1Mask)
120 #define XButtonEventMIsDown(x) ((x)->xbutton.state & Button2Mask)
121 #define XButtonEventRIsDown(x) ((x)->xbutton.state & Button3Mask)
122 #define XButtonEventShiftIsDown(x) (x->xbutton.state & ShiftMask)
123 #define XButtonEventCtrlIsDown(x) (x->xbutton.state & ControlMask)
124 #define XButtonEventAltIsDown(x) (x->xbutton.state & Mod3Mask)
125 #define XButtonEventMetaIsDown(x) (x->xbutton.state & Mod1Mask)
126 #define XButtonEventGetX(event) (event->xbutton.x)
127 #define XButtonEventGetY(event) (event->xbutton.y)
128 #define XKeyEventGetTime(event) (event->xkey.time)
129 #define XKeyEventShiftIsDown(x) (x->xkey.state & ShiftMask)
130 #define XKeyEventCtrlIsDown(x) (x->xkey.state & ControlMask)
131 #define XKeyEventAltIsDown(x) (x->xkey.state & Mod3Mask)
132 #define XKeyEventMetaIsDown(x) (x->xkey.state & Mod1Mask)
133 #define XKeyEventGetX(event) (event->xkey.x)
134 #define XKeyEventGetY(event) (event->xkey.y)
135 #define XFontStructGetAscent(f) f->ascent
138 class WXDLLEXPORT wxXVisualInfo
143 void Init( Display
* dpy
, XVisualInfo
* visualInfo
);
145 int m_visualType
; // TrueColor, DirectColor etc.
147 int m_visualColormapSize
;
148 void *m_visualColormap
;
150 unsigned long m_visualRedMask
;
151 unsigned long m_visualGreenMask
;
152 unsigned long m_visualBlueMask
;
153 int m_visualRedShift
;
154 int m_visualGreenShift
;
155 int m_visualBlueShift
;
157 int m_visualGreenPrec
;
158 int m_visualBluePrec
;
160 unsigned char *m_colorCube
;
163 bool wxFillXVisualInfo( wxXVisualInfo
* vi
, Display
* dpy
);
165 #endif // _WX_PRIVX_H_