]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/x11/privx.h
removed unused enum
[wxWidgets.git] / include / wx / x11 / privx.h
... / ...
CommitLineData
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
21class wxMouseEvent;
22class wxKeyEvent;
23class wxWindow;
24
25// ----------------------------------------------------------------------------
26// key events related functions
27// ----------------------------------------------------------------------------
28
29extern int wxCharCodeXToWX(KeySym keySym);
30extern KeySym wxCharCodeWXToX(int id);
31
32int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
33Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
34
35extern XColor g_itemColors[];
36extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
37
38// For convenience
39inline 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
48typedef 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
55void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
56void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
57void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);
58void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor);
59
60// For debugging
61#ifdef __WXDEBUG__
62wxString wxGetXEventName(XEvent& event);
63#endif
64
65// Is the window visible?
66bool wxWindowIsVisible(Window win);
67
68#if wxUSE_NANOX
69#define XEventGetWindow(event) event->general.wid
70#define XEventGetType(event) event->general.type
71#define XConfigureEventGetX(event) ((int) event->update.x)
72#define XConfigureEventGetY(event) ((int) event->update.y)
73#define XConfigureEventGetWidth(event) ((int) event->update.width)
74#define XConfigureEventGetHeight(event) ((int) event->update.height)
75#define XExposeEventGetX(event) event->exposure.x
76#define XExposeEventGetY(event) event->exposure.y
77#define XExposeEventGetWidth(event) event->exposure.width
78#define XExposeEventGetHeight(event) event->exposure.height
79#define XButtonEventGetTime(event) (wxGetLocalTime())
80#define XButtonEventLChanged(event) (event->button.changebuttons & GR_BUTTON_L)
81#define XButtonEventMChanged(event) (event->button.changebuttons & GR_BUTTON_M)
82#define XButtonEventRChanged(event) (event->button.changebuttons & GR_BUTTON_R)
83#define XButtonEventLIsDown(x) ((x)->button.buttons & GR_BUTTON_L)
84#define XButtonEventMIsDown(x) ((x)->button.buttons & GR_BUTTON_M)
85#define XButtonEventRIsDown(x) ((x)->button.buttons & GR_BUTTON_R)
86#define XButtonEventShiftIsDown(x) (x->button.modifiers & MWKMOD_SHIFT)
87#define XButtonEventCtrlIsDown(x) (x->button.modifiers & MWKMOD_CTRL)
88#define XButtonEventAltIsDown(x) (x->button.modifiers & MWKMOD_ALT)
89#define XButtonEventMetaIsDown(x) (x->button.modifiers & MWKMOD_META)
90#define XButtonEventGetX(event) (event->button.x)
91#define XButtonEventGetY(event) (event->button.y)
92#define XKeyEventGetTime(event) (wxGetLocalTime())
93#define XKeyEventGetX(event) (event->keystroke.x)
94#define XKeyEventGetY(event) (event->keystroke.y)
95#define XKeyEventShiftIsDown(x) (x->keystroke.modifiers & MWKMOD_SHIFT)
96#define XKeyEventCtrlIsDown(x) (x->keystroke.modifiers & MWKMOD_CTRL)
97#define XKeyEventAltIsDown(x) (x->keystroke.modifiers & MWKMOD_ALT)
98#define XKeyEventMetaIsDown(x) (x->keystroke.modifiers & MWKMOD_META)
99#define XFontStructGetAscent(f) f->info.baseline
100
101#else
102
103#define XEventGetWindow(event) event->xany.window
104#define XEventGetType(event) event->xany.type
105#define XConfigureEventGetX(event) event->xconfigure.x
106#define XConfigureEventGetY(event) event->xconfigure.y
107#define XConfigureEventGetWidth(event) event->xconfigure.width
108#define XConfigureEventGetHeight(event) event->xconfigure.height
109#define XExposeEventGetX(event) event->xexpose.x
110#define XExposeEventGetY(event) event->xexpose.y
111#define XExposeEventGetWidth(event) event->xexpose.width
112#define XExposeEventGetHeight(event) event->xexpose.height
113#define XButtonEventGetTime(event) (event->xbutton.time)
114#define XButtonEventLChanged(event) (event->xbutton.button == Button1)
115#define XButtonEventMChanged(event) (event->xbutton.button == Button2)
116#define XButtonEventRChanged(event) (event->xbutton.button == Button3)
117#define XButtonEventLIsDown(x) ((x)->xbutton.state & Button1Mask)
118#define XButtonEventMIsDown(x) ((x)->xbutton.state & Button2Mask)
119#define XButtonEventRIsDown(x) ((x)->xbutton.state & Button3Mask)
120#define XButtonEventShiftIsDown(x) (x->xbutton.state & ShiftMask)
121#define XButtonEventCtrlIsDown(x) (x->xbutton.state & ControlMask)
122#define XButtonEventAltIsDown(x) (x->xbutton.state & Mod3Mask)
123#define XButtonEventMetaIsDown(x) (x->xbutton.state & Mod1Mask)
124#define XButtonEventGetX(event) (event->xbutton.x)
125#define XButtonEventGetY(event) (event->xbutton.y)
126#define XKeyEventGetTime(event) (event->xkey.time)
127#define XKeyEventShiftIsDown(x) (x->xkey.state & ShiftMask)
128#define XKeyEventCtrlIsDown(x) (x->xkey.state & ControlMask)
129#define XKeyEventAltIsDown(x) (x->xkey.state & Mod3Mask)
130#define XKeyEventMetaIsDown(x) (x->xkey.state & Mod1Mask)
131#define XKeyEventGetX(event) (event->xkey.x)
132#define XKeyEventGetY(event) (event->xkey.y)
133#define XFontStructGetAscent(f) f->ascent
134#endif
135
136#endif
137// _WX_PRIVX_H_