]>
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" | |
16 | ||
34636400 VZ |
17 | class wxMouseEvent; |
18 | class wxKeyEvent; | |
dfc54541 | 19 | |
34636400 VZ |
20 | // Put any private declarations here: native Motif types may be used because |
21 | // this header is included after Xm/Xm.h | |
9b6dbb09 | 22 | |
34636400 VZ |
23 | // ---------------------------------------------------------------------------- |
24 | // common callbacks | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
27 | // All widgets should have this as their resize proc. | |
9b6dbb09 JS |
28 | extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, String args[], int *num_args); |
29 | ||
34636400 VZ |
30 | // For repainting arbitrary windows |
31 | void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *); | |
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 | ||
9b6dbb09 JS |
38 | extern void wxDeleteWindowFromTable(Widget w); |
39 | extern wxWindow *wxGetWindowFromTable(Widget w); | |
40 | extern bool wxAddWindowToTable(Widget w, wxWindow *win); | |
34636400 | 41 | |
31528cd3 VZ |
42 | // ---------------------------------------------------------------------------- |
43 | // key events related functions | |
44 | // ---------------------------------------------------------------------------- | |
45 | ||
50414e24 | 46 | extern char wxFindMnemonic(const char* s); |
31528cd3 VZ |
47 | |
48 | extern char * wxFindAccelerator (const char *s); | |
49 | extern XmString wxFindAcceleratorText (const char *s); | |
50 | ||
50414e24 JS |
51 | extern int wxCharCodeXToWX(KeySym keySym); |
52 | extern KeySym wxCharCodeWXToX(int id); | |
34636400 VZ |
53 | |
54 | // ---------------------------------------------------------------------------- | |
55 | // TranslateXXXEvent() functions - translate Motif event to wxWindow one | |
56 | // ---------------------------------------------------------------------------- | |
57 | extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent); | |
58 | extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent); | |
59 | ||
dfc54541 | 60 | int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap); |
a4294b78 | 61 | Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ); |
34636400 | 62 | |
0d57be45 JS |
63 | extern XColor g_itemColors[]; |
64 | extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore); | |
02e8b2f9 | 65 | |
94b49b93 JS |
66 | extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour); |
67 | extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE); | |
68 | ||
34636400 | 69 | #define wxNO_COLORS 0x00 |
02e8b2f9 JS |
70 | #define wxBACK_COLORS 0x01 |
71 | #define wxFORE_COLORS 0x02 | |
72 | ||
73 | extern XColor itemColors[5] ; | |
74 | ||
75 | #define wxBACK_INDEX 0 | |
76 | #define wxFORE_INDEX 1 | |
77 | #define wxSELE_INDEX 2 | |
78 | #define wxTOPS_INDEX 3 | |
79 | #define wxBOTS_INDEX 4 | |
9b6dbb09 | 80 | |
ee31c392 VZ |
81 | // ---------------------------------------------------------------------------- |
82 | // utility classes | |
83 | // ---------------------------------------------------------------------------- | |
84 | ||
85 | // XmString made easy to use in wxWindows (and has an added benefit of | |
86 | // cleaning up automatically) | |
87 | class wxXmString | |
88 | { | |
89 | public: | |
90 | wxXmString(const wxString& str) | |
91 | { | |
92 | m_string = XmStringCreateLtoR((char *)str.c_str(), | |
93 | XmSTRING_DEFAULT_CHARSET); | |
94 | } | |
95 | ||
96 | ~wxXmString() { XmStringFree(m_string); } | |
97 | ||
98 | // semi-implicit conversion to XmString (shouldn't rely on implicit | |
99 | // conversion because many of Motif functions are macros) | |
100 | XmString operator()() const { return m_string; } | |
101 | ||
102 | private: | |
103 | XmString m_string; | |
104 | }; | |
105 | ||
106 | // ---------------------------------------------------------------------------- | |
107 | // macros to avoid casting WXFOO to Foo all the time | |
108 | // ---------------------------------------------------------------------------- | |
109 | ||
110 | // argument is of type "wxWindow *" | |
111 | #define GetWidget(w) ((Widget)(w)->GetHandle()) | |
112 | ||
d391a345 VZ |
113 | // ---------------------------------------------------------------------------- |
114 | // accessors for C modules | |
115 | // ---------------------------------------------------------------------------- | |
116 | ||
117 | extern "C" XtAppContext wxGetAppContext(); | |
118 | ||
9b6dbb09 JS |
119 | #endif |
120 | // _WX_PRIVATE_H_ |