]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/privx.h
added missing default values for the 2nd argument of DeleteEntry()
[wxWidgets.git] / include / wx / x11 / privx.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: privx.h
3 // Purpose: Private declarations common to X11 and Motif ports
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_PRIVX_H_
13 #define _WX_PRIVX_H_
14
15 #include "wx/defs.h"
16 #include "wx/utils.h"
17 #include "X11/Xlib.h"
18 #include "X11/Xatom.h"
19 #include "X11/Xutil.h"
20
21 class wxMouseEvent;
22 class wxKeyEvent;
23 class wxWindow;
24
25 // ----------------------------------------------------------------------------
26 // key events related functions
27 // ----------------------------------------------------------------------------
28
29 extern int wxCharCodeXToWX(KeySym keySym);
30 extern KeySym wxCharCodeWXToX(int id);
31
32 int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
33 Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
34
35 extern XColor g_itemColors[];
36 extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
37
38 // For convenience
39 inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); }
40
41 #define wxMAX_RGB 0xff
42 #define wxMAX_SV 1000
43 #define wxSIGN(x) ((x < 0) ? -x : x)
44 #define wxH_WEIGHT 4
45 #define wxS_WEIGHT 1
46 #define wxV_WEIGHT 2
47
48 typedef struct wx_hsv {
49 int h,s,v;
50 } wxHSV;
51
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))
54
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);
59
60 // For debugging
61 #ifdef __WXDEBUG__
62 wxString wxGetXEventName(XEvent& event);
63 #endif
64
65 // Is the window visible?
66 bool wxWindowIsVisible(Window win);
67
68 #if wxUSE_NANOX
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
98
99 #else
100
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
130 #endif
131
132 #endif
133 // _WX_PRIVX_H_