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"
19 #if defined( __cplusplus ) && defined( __VMS )
20 #pragma message disable nosimpint
23 #include "X11/Xatom.h"
24 #include "X11/Xutil.h"
25 #if defined( __cplusplus ) && defined( __VMS )
26 #pragma message enable nosimpint
29 class WXDLLIMPEXP_FWD_CORE wxMouseEvent
;
30 class WXDLLIMPEXP_FWD_CORE wxKeyEvent
;
31 class WXDLLIMPEXP_FWD_CORE wxWindow
;
32 class WXDLLIMPEXP_FWD_CORE wxRegion
;
34 // ----------------------------------------------------------------------------
35 // key events related functions
36 // ----------------------------------------------------------------------------
38 WXPixel
wxGetBestMatchingPixel(Display
*display
, XColor
*desiredColor
, Colormap cmap
);
39 Pixmap
XCreateInsensitivePixmap( Display
*display
, Pixmap pixmap
);
41 extern XColor g_itemColors
[];
42 extern int wxComputeColours (Display
*display
, const wxColour
* back
, const wxColour
* fore
);
45 inline Display
* wxGlobalDisplay() { return (Display
*) wxGetDisplay(); }
47 #define wxMAX_RGB 0xff
49 #define wxSIGN(x) ((x < 0) ? -x : x)
54 typedef struct wx_hsv
{
58 #define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
59 #define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
61 void wxHSVToXColor(wxHSV
*hsv
,XColor
*xcolor
);
62 void wxXColorToHSV(wxHSV
*hsv
,XColor
*xcolor
);
63 void wxAllocNearestColor(Display
*display
,Colormap colormap
,XColor
*xcolor
);
64 void wxAllocColor(Display
*display
,Colormap colormap
,XColor
*xcolor
);
67 wxString
wxGetXEventName(XEvent
& event
);
69 // Is the window visible?
70 bool wxWindowIsVisible(Window win
);
73 #define XEventGetWindow(event) event->general.wid
74 #define XEventGetType(event) event->general.type
75 #define XConfigureEventGetX(event) ((int) event->update.x)
76 #define XConfigureEventGetY(event) ((int) event->update.y)
77 #define XConfigureEventGetWidth(event) ((int) event->update.width)
78 #define XConfigureEventGetHeight(event) ((int) event->update.height)
79 #define XExposeEventGetX(event) event->exposure.x
80 #define XExposeEventGetY(event) event->exposure.y
81 #define XExposeEventGetWidth(event) event->exposure.width
82 #define XExposeEventGetHeight(event) event->exposure.height
83 #define XButtonEventGetTime(event) (wxGetLocalTime())
84 #define XButtonEventLChanged(event) (event->button.changebuttons & GR_BUTTON_L)
85 #define XButtonEventMChanged(event) (event->button.changebuttons & GR_BUTTON_M)
86 #define XButtonEventRChanged(event) (event->button.changebuttons & GR_BUTTON_R)
87 #define XButtonEventLIsDown(x) ((x)->button.buttons & GR_BUTTON_L)
88 #define XButtonEventMIsDown(x) ((x)->button.buttons & GR_BUTTON_M)
89 #define XButtonEventRIsDown(x) ((x)->button.buttons & GR_BUTTON_R)
90 #define XButtonEventShiftIsDown(x) (x->button.modifiers & MWKMOD_SHIFT)
91 #define XButtonEventCtrlIsDown(x) (x->button.modifiers & MWKMOD_CTRL)
92 #define XButtonEventAltIsDown(x) (x->button.modifiers & MWKMOD_ALT)
93 #define XButtonEventMetaIsDown(x) (x->button.modifiers & MWKMOD_META)
94 #define XButtonEventGetX(event) (event->button.x)
95 #define XButtonEventGetY(event) (event->button.y)
96 #define XKeyEventGetTime(event) (wxGetLocalTime())
97 #define XKeyEventGetX(event) (event->keystroke.x)
98 #define XKeyEventGetY(event) (event->keystroke.y)
99 #define XKeyEventShiftIsDown(x) (x->keystroke.modifiers & MWKMOD_SHIFT)
100 #define XKeyEventCtrlIsDown(x) (x->keystroke.modifiers & MWKMOD_CTRL)
101 #define XKeyEventAltIsDown(x) (x->keystroke.modifiers & MWKMOD_ALT)
102 #define XKeyEventMetaIsDown(x) (x->keystroke.modifiers & MWKMOD_META)
103 #define XFontStructGetAscent(f) f->info.baseline
107 #define XEventGetWindow(event) event->xany.window
108 #define XEventGetType(event) event->xany.type
109 #define XConfigureEventGetX(event) event->xconfigure.x
110 #define XConfigureEventGetY(event) event->xconfigure.y
111 #define XConfigureEventGetWidth(event) event->xconfigure.width
112 #define XConfigureEventGetHeight(event) event->xconfigure.height
113 #define XExposeEventGetX(event) event->xexpose.x
114 #define XExposeEventGetY(event) event->xexpose.y
115 #define XExposeEventGetWidth(event) event->xexpose.width
116 #define XExposeEventGetHeight(event) event->xexpose.height
117 #define XButtonEventGetTime(event) (event->xbutton.time)
118 #define XButtonEventLChanged(event) (event->xbutton.button == Button1)
119 #define XButtonEventMChanged(event) (event->xbutton.button == Button2)
120 #define XButtonEventRChanged(event) (event->xbutton.button == Button3)
121 #define XButtonEventLIsDown(x) ((x)->xbutton.state & Button1Mask)
122 #define XButtonEventMIsDown(x) ((x)->xbutton.state & Button2Mask)
123 #define XButtonEventRIsDown(x) ((x)->xbutton.state & Button3Mask)
124 #define XButtonEventShiftIsDown(x) (x->xbutton.state & ShiftMask)
125 #define XButtonEventCtrlIsDown(x) (x->xbutton.state & ControlMask)
126 #define XButtonEventAltIsDown(x) (x->xbutton.state & Mod3Mask)
127 #define XButtonEventMetaIsDown(x) (x->xbutton.state & Mod1Mask)
128 #define XButtonEventGetX(event) (event->xbutton.x)
129 #define XButtonEventGetY(event) (event->xbutton.y)
130 #define XKeyEventGetTime(event) (event->xkey.time)
131 #define XKeyEventShiftIsDown(x) (x->xkey.state & ShiftMask)
132 #define XKeyEventCtrlIsDown(x) (x->xkey.state & ControlMask)
133 #define XKeyEventAltIsDown(x) (x->xkey.state & Mod3Mask)
134 #define XKeyEventMetaIsDown(x) (x->xkey.state & Mod1Mask)
135 #define XKeyEventGetX(event) (event->xkey.x)
136 #define XKeyEventGetY(event) (event->xkey.y)
137 #define XFontStructGetAscent(f) f->ascent
140 // ----------------------------------------------------------------------------
142 // ----------------------------------------------------------------------------
144 bool wxDoSetShape( Display
* xdisplay
, Window xwindow
, const wxRegion
& region
);
146 class WXDLLIMPEXP_CORE wxXVisualInfo
151 void Init( Display
* dpy
, XVisualInfo
* visualInfo
);
153 int m_visualType
; // TrueColor, DirectColor etc.
155 int m_visualColormapSize
;
156 void *m_visualColormap
;
158 unsigned long m_visualRedMask
;
159 unsigned long m_visualGreenMask
;
160 unsigned long m_visualBlueMask
;
161 int m_visualRedShift
;
162 int m_visualGreenShift
;
163 int m_visualBlueShift
;
165 int m_visualGreenPrec
;
166 int m_visualBluePrec
;
168 unsigned char *m_colorCube
;
171 bool wxFillXVisualInfo( wxXVisualInfo
* vi
, Display
* dpy
);
173 #endif // _WX_PRIVX_H_