]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/private.h
541db7b10bfb9d203bd3c00abb890b6beaad6556
[wxWidgets.git] / include / wx / x11 / private.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: private.h
3 // Purpose: Private declarations for X11 port
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_PRIVATE_H_
13 #define _WX_PRIVATE_H_
14
15 #include "wx/defs.h"
16 #include "X11/Xlib.h"
17
18 class wxMouseEvent;
19 class wxKeyEvent;
20
21 // ----------------------------------------------------------------------------
22 // common callbacks
23 // ----------------------------------------------------------------------------
24
25 #if 0
26 // All widgets should have this as their resize proc.
27 extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, String args[], int *num_args);
28
29 // For repainting arbitrary windows
30 void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *);
31 #endif
32
33 // ----------------------------------------------------------------------------
34 // we maintain a hash table which contains the mapping from Widget to wxWindow
35 // corresponding to the window for this widget
36 // ----------------------------------------------------------------------------
37
38 extern void wxDeleteWindowFromTable(Window w);
39 extern wxWindow *wxGetWindowFromTable(Window w);
40 extern bool wxAddWindowToTable(Window w, wxWindow *win);
41
42 // ----------------------------------------------------------------------------
43 // key events related functions
44 // ----------------------------------------------------------------------------
45
46 extern char wxFindMnemonic(const char* s);
47
48 extern char * wxFindAccelerator (const char *s);
49 //extern XmString wxFindAcceleratorText (const char *s);
50
51 extern int wxCharCodeXToWX(KeySym keySym);
52 extern KeySym wxCharCodeWXToX(int id);
53
54 // ----------------------------------------------------------------------------
55 // TranslateXXXEvent() functions - translate Motif event to wxWindow one
56 // ----------------------------------------------------------------------------
57 extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, XEvent *xevent);
58 extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window window, XEvent *xevent);
59
60 int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
61 Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
62
63 extern XColor g_itemColors[];
64 extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
65
66 extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
67 extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
68
69 extern Window wxGetWindowParent(Window window);
70
71 // For convenience
72 inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); }
73
74 #define wxNO_COLORS 0x00
75 #define wxBACK_COLORS 0x01
76 #define wxFORE_COLORS 0x02
77
78 extern XColor itemColors[5] ;
79
80 #define wxBACK_INDEX 0
81 #define wxFORE_INDEX 1
82 #define wxSELE_INDEX 2
83 #define wxTOPS_INDEX 3
84 #define wxBOTS_INDEX 4
85
86 #define wxMAX_RGB 0xff
87 #define wxMAX_SV 1000
88 #define wxSIGN(x) ((x < 0) ? -x : x)
89 #define wxH_WEIGHT 4
90 #define wxS_WEIGHT 1
91 #define wxV_WEIGHT 2
92
93 typedef struct wx_hsv {
94 int h,s,v;
95 } wxHSV;
96
97 #define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
98 #define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
99
100 void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
101 void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
102 void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);
103 void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor);
104
105 // ----------------------------------------------------------------------------
106 // accessors for C modules
107 // ----------------------------------------------------------------------------
108
109 // extern "C" XtAppContext wxGetAppContext();
110
111 #endif
112 // _WX_PRIVATE_H_