]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/private.h
added wxUpdateUIEvent handling to wxMGL
[wxWidgets.git] / include / wx / motif / private.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: private.h
3 // Purpose: Private declarations for wxMotif 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 // Put any private declarations here: native Motif types may be used because
22 // this header is included after Xm/Xm.h
23
24 // ----------------------------------------------------------------------------
25 // common callbacks
26 // ----------------------------------------------------------------------------
27
28 // All widgets should have this as their resize proc.
29 extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, String args[], int *num_args);
30
31 // For repainting arbitrary windows
32 void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *);
33
34 // ----------------------------------------------------------------------------
35 // we maintain a hash table which contains the mapping from Widget to wxWindow
36 // corresponding to the window for this widget
37 // ----------------------------------------------------------------------------
38
39 extern void wxDeleteWindowFromTable(Widget w);
40 extern wxWindow *wxGetWindowFromTable(Widget w);
41 extern bool wxAddWindowToTable(Widget w, wxWindow *win);
42
43 // ----------------------------------------------------------------------------
44 // key events related functions
45 // ----------------------------------------------------------------------------
46
47 extern char wxFindMnemonic(const char* s);
48
49 extern char * wxFindAccelerator (const char *s);
50 extern XmString wxFindAcceleratorText (const char *s);
51
52 extern int wxCharCodeXToWX(KeySym keySym);
53 extern KeySym wxCharCodeWXToX(int id);
54
55 // ----------------------------------------------------------------------------
56 // TranslateXXXEvent() functions - translate Motif event to wxWindow one
57 // ----------------------------------------------------------------------------
58 extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
59 extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
60
61 int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
62 Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
63
64 extern XColor g_itemColors[];
65 extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
66
67 extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
68 extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
69
70 #define wxNO_COLORS 0x00
71 #define wxBACK_COLORS 0x01
72 #define wxFORE_COLORS 0x02
73
74 extern XColor itemColors[5] ;
75
76 #define wxBACK_INDEX 0
77 #define wxFORE_INDEX 1
78 #define wxSELE_INDEX 2
79 #define wxTOPS_INDEX 3
80 #define wxBOTS_INDEX 4
81
82 // ----------------------------------------------------------------------------
83 // utility classes
84 // ----------------------------------------------------------------------------
85
86 // XmString made easy to use in wxWindows (and has an added benefit of
87 // cleaning up automatically)
88 class wxXmString
89 {
90 public:
91 wxXmString(const wxString& str)
92 {
93 m_string = XmStringCreateLtoR((char *)str.c_str(),
94 XmSTRING_DEFAULT_CHARSET);
95 }
96
97 ~wxXmString() { XmStringFree(m_string); }
98
99 // semi-implicit conversion to XmString (shouldn't rely on implicit
100 // conversion because many of Motif functions are macros)
101 XmString operator()() const { return m_string; }
102
103 private:
104 XmString m_string;
105 };
106
107 // ----------------------------------------------------------------------------
108 // macros to avoid casting WXFOO to Foo all the time
109 // ----------------------------------------------------------------------------
110
111 // argument is of type "wxWindow *"
112 #define GetWidget(w) ((Widget)(w)->GetHandle())
113
114 // ----------------------------------------------------------------------------
115 // accessors for C modules
116 // ----------------------------------------------------------------------------
117
118 extern "C" XtAppContext wxGetAppContext();
119
120 #define wxMAX_RGB 0xff
121 #define wxMAX_SV 1000
122 #define wxSIGN(x) ((x < 0) ? -x : x)
123 #define wxH_WEIGHT 4
124 #define wxS_WEIGHT 1
125 #define wxV_WEIGHT 2
126
127 typedef struct wx_hsv {
128 int h,s,v;
129 } wxHSV;
130
131 #define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
132 #define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
133
134 void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
135 void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
136 void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);
137 void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor);
138
139 #endif
140 // _WX_PRIVATE_H_