]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/privx.h
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 /////////////////////////////////////////////////////////////////////////////
18 #include "X11/Xatom.h"
19 #include "X11/Xutil.h"
25 // ----------------------------------------------------------------------------
26 // key events related functions
27 // ----------------------------------------------------------------------------
29 extern int wxCharCodeXToWX(KeySym keySym
);
30 extern KeySym
wxCharCodeWXToX(int id
);
32 int wxGetBestMatchingPixel(Display
*display
, XColor
*desiredColor
, Colormap cmap
);
33 Pixmap
XCreateInsensitivePixmap( Display
*display
, Pixmap pixmap
);
35 extern XColor g_itemColors
[];
36 extern int wxComputeColours (Display
*display
, wxColour
* back
, wxColour
* fore
);
39 inline Display
* wxGlobalDisplay() { return (Display
*) wxGetDisplay(); }
41 #define wxMAX_RGB 0xff
43 #define wxSIGN(x) ((x < 0) ? -x : x)
48 typedef struct wx_hsv
{
52 #define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
53 #define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
55 void wxHSVToXColor(wxHSV
*hsv
,XColor
*xcolor
);
56 void wxXColorToHSV(wxHSV
*hsv
,XColor
*xcolor
);
57 void wxAllocNearestColor(Display
*display
,Colormap colormap
,XColor
*xcolor
);
58 void wxAllocColor(Display
*display
,Colormap colormap
,XColor
*xcolor
);
62 wxString
wxGetXEventName(XEvent
& event
);
65 // Is the window visible?
66 bool wxWindowIsVisible(Window win
);
69 #define XEventGetWindow(event) event->general.wid
70 #define XEventGetType(event) event->general.type
71 #define XConfigureEventGetWidth(event) ((int) event->update.width)
72 #define XConfigureEventGetHeight(event) ((int) event->update.height)
73 #define XExposeEventGetX(event) event->exposure.x
74 #define XExposeEventGetY(event) event->exposure.y
75 #define XExposeEventGetWidth(event) event->exposure.width
76 #define XExposeEventGetHeight(event) event->exposure.height
77 #define XButtonEventGetTime(event) (wxGetLocalTime())
78 #define XButtonEventLChanged(event) (event->button.changebuttons & GR_BUTTON_L)
79 #define XButtonEventMChanged(event) (event->button.changebuttons & GR_BUTTON_M)
80 #define XButtonEventRChanged(event) (event->button.changebuttons & GR_BUTTON_R)
81 #define XButtonEventLIsDown(x) ((x)->button.buttons & GR_BUTTON_L)
82 #define XButtonEventMIsDown(x) ((x)->button.buttons & GR_BUTTON_M)
83 #define XButtonEventRIsDown(x) ((x)->button.buttons & GR_BUTTON_R)
84 #define XButtonEventShiftIsDown(x) (x->button.modifiers & MWKMOD_SHIFT)
85 #define XButtonEventCtrlIsDown(x) (x->button.modifiers & MWKMOD_CTRL)
86 #define XButtonEventAltIsDown(x) (x->button.modifiers & MWKMOD_ALT)
87 #define XButtonEventMetaIsDown(x) (x->button.modifiers & MWKMOD_META)
88 #define XButtonEventGetX(event) (event->button.x)
89 #define XButtonEventGetY(event) (event->button.y)
90 #define XKeyEventGetTime(event) (wxGetLocalTime())
91 #define XKeyEventGetX(event) (event->keystroke.x)
92 #define XKeyEventGetY(event) (event->keystroke.y)
93 #define XKeyEventShiftIsDown(x) (x->keystroke.modifiers & MWKMOD_SHIFT)
94 #define XKeyEventCtrlIsDown(x) (x->keystroke.modifiers & MWKMOD_CTRL)
95 #define XKeyEventAltIsDown(x) (x->keystroke.modifiers & MWKMOD_ALT)
96 #define XKeyEventMetaIsDown(x) (x->keystroke.modifiers & MWKMOD_META)
97 #define XFontStructGetAscent(f) f->info.baseline
101 #define XEventGetWindow(event) event->xany.window
102 #define XEventGetType(event) event->xany.type
103 #define XConfigureEventGetWidth(event) event->xconfigure.width
104 #define XConfigureEventGetHeight(event) event->xconfigure.height
105 #define XExposeEventGetX(event) event->xexpose.x
106 #define XExposeEventGetY(event) event->xexpose.y
107 #define XExposeEventGetWidth(event) event->xexpose.width
108 #define XExposeEventGetHeight(event) event->xexpose.height
109 #define XButtonEventGetTime(event) (event->xbutton.time)
110 #define XButtonEventLChanged(event) (event->xbutton.button == Button1)
111 #define XButtonEventMChanged(event) (event->xbutton.button == Button2)
112 #define XButtonEventRChanged(event) (event->xbutton.button == Button3)
113 #define XButtonEventLIsDown(x) ((x)->xbutton.state & Button1Mask)
114 #define XButtonEventMIsDown(x) ((x)->xbutton.state & Button2Mask)
115 #define XButtonEventRIsDown(x) ((x)->xbutton.state & Button3Mask)
116 #define XButtonEventShiftIsDown(x) (x->xbutton.state & ShiftMask)
117 #define XButtonEventCtrlIsDown(x) (x->xbutton.state & ControlMask)
118 #define XButtonEventAltIsDown(x) (x->xbutton.state & Mod3Mask)
119 #define XButtonEventMetaIsDown(x) (x->xbutton.state & Mod1Mask)
120 #define XButtonEventGetX(event) (event->xbutton.x)
121 #define XButtonEventGetY(event) (event->xbutton.y)
122 #define XKeyEventGetTime(event) (event->xkey.time)
123 #define XKeyEventShiftIsDown(x) (x->xkey.state & ShiftMask)
124 #define XKeyEventCtrlIsDown(x) (x->xkey.state & ControlMask)
125 #define XKeyEventAltIsDown(x) (x->xkey.state & Mod3Mask)
126 #define XKeyEventMetaIsDown(x) (x->xkey.state & Mod1Mask)
127 #define XKeyEventGetX(event) (event->xkey.x)
128 #define XKeyEventGetY(event) (event->xkey.y)
129 #define XFontStructGetAscent(f) f->ascent