]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: private.h | |
34636400 | 3 | // Purpose: Private declarations for wxMotif port |
9b6dbb09 JS |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
34636400 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_PRIVATE_H_ | |
13 | #define _WX_PRIVATE_H_ | |
14 | ||
15 | #include "wx/defs.h" | |
7266b672 | 16 | #include "X11/Xlib.h" |
9b6dbb09 | 17 | |
34636400 VZ |
18 | class wxMouseEvent; |
19 | class wxKeyEvent; | |
dfc54541 | 20 | |
34636400 VZ |
21 | // Put any private declarations here: native Motif types may be used because |
22 | // this header is included after Xm/Xm.h | |
9b6dbb09 | 23 | |
34636400 VZ |
24 | // ---------------------------------------------------------------------------- |
25 | // common callbacks | |
26 | // ---------------------------------------------------------------------------- | |
27 | ||
28 | // All widgets should have this as their resize proc. | |
9b6dbb09 JS |
29 | extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, String args[], int *num_args); |
30 | ||
34636400 VZ |
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 | ||
9b6dbb09 JS |
39 | extern void wxDeleteWindowFromTable(Widget w); |
40 | extern wxWindow *wxGetWindowFromTable(Widget w); | |
41 | extern bool wxAddWindowToTable(Widget w, wxWindow *win); | |
34636400 | 42 | |
31528cd3 VZ |
43 | // ---------------------------------------------------------------------------- |
44 | // key events related functions | |
45 | // ---------------------------------------------------------------------------- | |
46 | ||
50414e24 | 47 | extern char wxFindMnemonic(const char* s); |
31528cd3 VZ |
48 | |
49 | extern char * wxFindAccelerator (const char *s); | |
50 | extern XmString wxFindAcceleratorText (const char *s); | |
51 | ||
50414e24 JS |
52 | extern int wxCharCodeXToWX(KeySym keySym); |
53 | extern KeySym wxCharCodeWXToX(int id); | |
34636400 VZ |
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 | ||
dfc54541 | 61 | int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap); |
a4294b78 | 62 | Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ); |
34636400 | 63 | |
0d57be45 JS |
64 | extern XColor g_itemColors[]; |
65 | extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore); | |
02e8b2f9 | 66 | |
94b49b93 JS |
67 | extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour); |
68 | extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE); | |
69 | ||
34636400 | 70 | #define wxNO_COLORS 0x00 |
02e8b2f9 JS |
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 | |
9b6dbb09 | 81 | |
ee31c392 VZ |
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(), | |
83df96d6 | 94 | XmSTRING_DEFAULT_CHARSET); |
ee31c392 | 95 | } |
83df96d6 | 96 | |
ee31c392 | 97 | ~wxXmString() { XmStringFree(m_string); } |
83df96d6 | 98 | |
ee31c392 VZ |
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; } | |
83df96d6 | 102 | |
ee31c392 VZ |
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 | ||
d391a345 VZ |
114 | // ---------------------------------------------------------------------------- |
115 | // accessors for C modules | |
116 | // ---------------------------------------------------------------------------- | |
117 | ||
118 | extern "C" XtAppContext wxGetAppContext(); | |
119 | ||
7266b672 JS |
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 | ||
9b6dbb09 | 139 | #endif |
83df96d6 | 140 | // _WX_PRIVATE_H_ |