]>
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 | |
3a0b23eb | 18 | #include "wx/x11/privx.h" |
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 | ||
34636400 VZ |
51 | // ---------------------------------------------------------------------------- |
52 | // TranslateXXXEvent() functions - translate Motif event to wxWindow one | |
53 | // ---------------------------------------------------------------------------- | |
54 | extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent); | |
55 | extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent); | |
56 | ||
94b49b93 JS |
57 | extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour); |
58 | extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE); | |
59 | ||
34636400 | 60 | #define wxNO_COLORS 0x00 |
02e8b2f9 JS |
61 | #define wxBACK_COLORS 0x01 |
62 | #define wxFORE_COLORS 0x02 | |
63 | ||
64 | extern XColor itemColors[5] ; | |
65 | ||
66 | #define wxBACK_INDEX 0 | |
67 | #define wxFORE_INDEX 1 | |
68 | #define wxSELE_INDEX 2 | |
69 | #define wxTOPS_INDEX 3 | |
70 | #define wxBOTS_INDEX 4 | |
9b6dbb09 | 71 | |
ee31c392 VZ |
72 | // ---------------------------------------------------------------------------- |
73 | // utility classes | |
74 | // ---------------------------------------------------------------------------- | |
75 | ||
76 | // XmString made easy to use in wxWindows (and has an added benefit of | |
77 | // cleaning up automatically) | |
78 | class wxXmString | |
79 | { | |
80 | public: | |
81 | wxXmString(const wxString& str) | |
82 | { | |
83 | m_string = XmStringCreateLtoR((char *)str.c_str(), | |
83df96d6 | 84 | XmSTRING_DEFAULT_CHARSET); |
ee31c392 | 85 | } |
83df96d6 | 86 | |
ee31c392 | 87 | ~wxXmString() { XmStringFree(m_string); } |
83df96d6 | 88 | |
ee31c392 VZ |
89 | // semi-implicit conversion to XmString (shouldn't rely on implicit |
90 | // conversion because many of Motif functions are macros) | |
91 | XmString operator()() const { return m_string; } | |
83df96d6 | 92 | |
ee31c392 VZ |
93 | private: |
94 | XmString m_string; | |
95 | }; | |
96 | ||
97 | // ---------------------------------------------------------------------------- | |
98 | // macros to avoid casting WXFOO to Foo all the time | |
99 | // ---------------------------------------------------------------------------- | |
100 | ||
101 | // argument is of type "wxWindow *" | |
102 | #define GetWidget(w) ((Widget)(w)->GetHandle()) | |
103 | ||
d391a345 VZ |
104 | // ---------------------------------------------------------------------------- |
105 | // accessors for C modules | |
106 | // ---------------------------------------------------------------------------- | |
107 | ||
108 | extern "C" XtAppContext wxGetAppContext(); | |
109 | ||
9b6dbb09 | 110 | #endif |
83df96d6 | 111 | // _WX_PRIVATE_H_ |